trufflesecurity / trufflehog

Find, verify, and analyze leaked credentials
https://trufflesecurity.com
GNU Affero General Public License v3.0
17.34k stars 1.72k forks source link

trufflehog fails to parse localized timestamp #3338

Open svenXY opened 1 month ago

svenXY commented 1 month ago

TruffleHog Version

trufflehog 3.82.5

Expected Behavior

trufflehog should parse localized timestamps correctly

Actual Behavior

2024-09-26T09:46:14+02:00   error   trufflehog  failed to parse commit date 
{"source_manager_worker_id": "wAMwt", "unit": "./my_repo_dir", "unit_kind": "dir", 
"repo": "git@gitlab.company.com:/some/repo.git", "commit": "3ec15209b4d1c854258f7d9ebb05cbbfbc3562fb", "latestState": "AuthorDateLine", 
"error": "parsing time \"Mo Sep 28 07:59:21 2020 +0000\" as \"Mon Jan 2 15:04:05 2006 -0700\": cannot parse \"Mo Sep 28 07:59:21 2020 +0000\" as \"Mon\""}

This is a german localized timestamp. trufflehog then reports found issues as following:

Found unverified result πŸ·πŸ”‘β“
[...]
Line: 23
Repository: ...
Timestamp: 0001-01-01 00:00:00 +0000

Environment

Additional Context

my LANG is at de_DE.UTF-8, however, setting this to C or en_US.UTF-8 changes nothing.

I ran this against a local repo with trufflehog git file://./my_repo_diras well as against its remote on gitlab with identical results

However, running tools like git, lazygit or tig locally work fine, e.g.

LANG=C git show 3ec15209b4d1c854258f7d9ebb05cbbfbc3562fb

commit 3ec15209b4d1c854258f7d9ebb05cbbfbc3562fb
Author: Me <me@example.com>
Date:   Mon Sep 28 09:59:21 2020

same with LANG set to en_US.UTF-8 or similar.

Maybe I'm forgetting to configure something here, but if so, I failed to find documentation or other issues regarding this.

svenXY commented 1 month ago
git cat-file -p 3ec15209b4d1c854258f7d9ebb05cbbfbc3562fb

tree 27a3ef59079f6673bd5286e554b5647dfe4a314e
author H., Sven - D010101 <sven@company.de> 1601279961 +0000
committer H., Sven - D010101 <sven@company.de> 1601279961 +0000

git does not have an locale either it seems

TimatGDC commented 1 month ago

Same issue here