Skip to content

Commit 8fbc917

Browse files
Merge pull request #151 from abnamro/2564645-commit-date-bugfix
[#2565302] Use Commit date from gitleaks if present.
2 parents 5d75cc1 + 8e80e35 commit 8fbc917

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/resc-vcs-scanner/src/vcs_scanner/secret_scanners/gitleaks_wrapper.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ def _parse_output(cls, file_path: str) -> List[FindingBase]:
123123
results = json.load(report_file)
124124

125125
for result in results:
126-
timestamp = "cls._is_valid_timestamp(result[Date])"
127-
if not timestamp:
126+
commit_timestamp = cls._is_valid_timestamp(result["Date"])
127+
if not commit_timestamp:
128128
logger.debug(f"{result['date']} has an unexpected date format. Expected ISO 8601")
129+
commit_timestamp = datetime.datetime.now()
129130
finding = FindingBase(file_path=result["File"],
130131
line_number=result["StartLine"],
131132
column_start=result["StartColumn"],
@@ -134,7 +135,7 @@ def _parse_output(cls, file_path: str) -> List[FindingBase]:
134135
author=result["Author"],
135136
commit_id=result["Commit"],
136137
commit_message=result["Message"],
137-
commit_timestamp=datetime.datetime.now(),
138+
commit_timestamp=commit_timestamp,
138139
rule_name=result["RuleID"])
139140

140141
findings.append(finding)

0 commit comments

Comments
 (0)