-
-
Notifications
You must be signed in to change notification settings - Fork 258
fix(vuln-scanner): bound trufflehog git-history scan, no more phantom-success runs #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aaronjmars
merged 6 commits into
aeonfun:main
from
Svector-anu:fix/trufflehog-git-history-timeout
Sep 5, 2026
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4eadbe6
fix(vuln-scanner): bound trufflehog git-history scan, no more phantom…
Svector-anu 08c6a4a
fix scanner timeout permissions and refresh integrity receipt
Svector-anu 09e89ae
fix(vuln-scanner): surface trufflehog-git status in every report/noti…
Svector-anu 306a511
preserve history scan status in reports and notifications
Svector-anu ea37f77
reconcile concurrent scanner reporting fix and refresh receipt
Svector-anu 8b4c982
classify trufflehog completion by exit status
Svector-anu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,9 +142,20 @@ fi | |
| if command -v trufflehog >/dev/null 2>&1; then | ||
| trufflehog filesystem . --only-verified --json \ | ||
| > /tmp/vuln-scan/trufflehog.json 2>/dev/null || true | ||
| # Also scan full git history for secrets | ||
| trufflehog git file://. --only-verified --json \ | ||
| > /tmp/vuln-scan/trufflehog-git.json 2>/dev/null || true | ||
| # Also scan full git history for secrets — BOUNDED. An unbounded `trufflehog git` | ||
| # walks every commit's every tree, and a large packed history (measured: 200 | ||
| # commits / ~369MB on one real run) can eat the whole turn budget by itself, | ||
| # with nothing to show it happened until the run reports "success" anyway | ||
| # having produced no report at all. `timeout` turns that silent budget-burn | ||
| # into an ordinary, honestly-recorded `fail` — same as an install failure, | ||
| # never a reason to write a "still running, will resume" placeholder as the | ||
| # final output. There is no resume: a workflow_dispatch run is one shot, and | ||
| # a note promising to pick back up later is not truthful about what a single | ||
| # run can actually do. | ||
| timeout 300 trufflehog git file://. --only-verified --json \ | ||
| > /tmp/vuln-scan/trufflehog-git.json 2>/dev/null | ||
| TRUFFLEHOG_GIT_RC=$? | ||
| [ "$TRUFFLEHOG_GIT_RC" = 124 ] && echo "VULN_SCANNER_TIMEOUT: trufflehog git history scan exceeded 300s on a large packed history — recorded as fail, not retried, not left unfinished" | ||
| else | ||
| echo "VULN_SCANNER_SKIPPED: trufflehog not available" | ||
| fi | ||
|
|
@@ -181,6 +192,15 @@ fi | |
| # Record what succeeded (empty output ≠ clean, could be tool failure) | ||
| echo "semgrep=$([ -s /tmp/vuln-scan/semgrep.json ] && echo ok || echo fail)" > /tmp/vuln-scan/sources.txt | ||
| echo "trufflehog=$([ -s /tmp/vuln-scan/trufflehog.json ] && echo ok || echo fail)" >> /tmp/vuln-scan/sources.txt | ||
| # Recorded separately from the filesystem pass above: they can genuinely diverge | ||
| # (filesystem scan clean and fast, git-history scan timed out on a large packed | ||
| # repo, or vice versa) and collapsing both into one trufflehog= line hides | ||
| # whichever one actually failed. | ||
| if [ "${TRUFFLEHOG_GIT_RC:-1}" = 124 ]; then | ||
| echo "trufflehog-git=timeout" >> /tmp/vuln-scan/sources.txt | ||
| else | ||
| echo "trufflehog-git=$([ -s /tmp/vuln-scan/trufflehog-git.json ] && echo ok || echo fail)" >> /tmp/vuln-scan/sources.txt | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ISSUE] Determine success from the TruffleHog exit code, not whether its JSON output is non-empty. A successful clean |
||
| fi | ||
| echo "osv=${OSV_STATUS:-fail}" >> /tmp/vuln-scan/sources.txt | ||
| ``` | ||
|
|
||
|
|
@@ -605,6 +625,19 @@ Append to `memory/vuln-scanned.json` (create if missing) so future runs skip thi | |
|
|
||
| ### A7. Write local report | ||
|
|
||
| **There is no resume.** Every scanner step above is now bounded (timeouts on the | ||
| slow ones, `command -v` guards on missing binaries), so nothing should genuinely | ||
| hang forever — but if you are still running low on turns by this point, finish | ||
| the report with whatever scanners actually completed, record the rest `fail` in | ||
| `sources.txt` (§A3's rule: unfinished is `fail`, not a pending state), and write | ||
| A7/A8 now. A single `workflow_dispatch` run is one shot with no continuation — | ||
| writing "still running, will pick this up automatically" as the final output is | ||
| not true of this run path (it was live-observed: a run reported workflow | ||
| `success` having written that sentence instead of a report, with no ledger entry | ||
| at all — the operator had to notice and re-dispatch by hand). A shorter, honest | ||
| report with some scanners marked `fail` is a completed task; a promise to | ||
| resume is not. | ||
|
|
||
| Save to `output/articles/vuln-scan-${today}.md` with sections for: repo metadata, scanner sources (ok/fail per tool), candidate count, confirmed findings with severity and channel, PoC gate status (`verified` with verifier/chain/block, `not-required` with reason, or `needs-verification`), and dedup note. Do **not** include exploit details for findings disclosed via PVR — redact file/line and link to the advisory ID instead. | ||
|
|
||
| ### A8. Notify | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ISSUE]
trufflehog-git=timeoutis not represented in any of the prescribed A7/A8/log status formats (which still expose onlytrufflehog=<ok|fail>), andtimeoutis outside their declaredok|failvocabulary — why it matters: a clean filesystem pass can still be reported astrufflehog=okwhile the timed-out history pass disappears from the durable report and operator notification, preserving the misleading-success failure this change is intended to fix.