ci(security-scan): surface Trivy findings in the run log (no more opaque exit 1)#371
Closed
seonghobae wants to merge 1 commit into
Closed
ci(security-scan): surface Trivy findings in the run log (no more opaque exit 1)#371seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
…il shows its reason The trivy-fs gate runs with format:sarif + exit-code:1, so when it blocks a PR the job log shows only "exit code 1" with no finding. Add a step that renders the produced trivy-results.sarif as a human-readable table (trivy convert, jq fallback) so a person reading the run log sees the exact package/CVE/misconfig, severity, file, and fixed version that failed the gate. No re-scan; reuses the SARIF already produced. always()-guarded so it also prints on success. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RTAMs4bpSZS77Xe3RQjv9P
Contributor
Author
|
Superseded by #382 and the newer Trivy SARIF-to-log implementation folded into that branch. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
The central
trivy-fsgate runs withformat: sarif+exit-code: "1". When Trivy finds a CRITICAL/HIGH issue it exits non-zero, but because output goes only to the SARIF file the job log shows justProcess completed with exit code 1— no package, no CVE, no misconfig id. A human (or another agent) reading the run cannot tell why the required gate failed.This was hit for real on
ContextualWisdomLab/pg-llm-batchPR #1: the failing run logged onlyexit code 1; the actual cause (DS-0002 (HIGH)— missing non-rootUSERin two Dockerfiles) was invisible until the SARIF was reconstructed by hand.What
Add a
Report Trivy findings (reason this gate failed)step that renders the already-producedtrivy-results.sarifas a human-readable table:trivy convert --format table trivy-results.sarif(thetrivybinary is already on PATH fromsetup-trivy)jqthat prints[level] ruleId security-severity=… file: messageper findingNo re-scan (reuses the SARIF the gate already wrote),
always()-guarded so it prints on pass and fail, and it does not change the gate result. Satisfies the "every failure must show its reason in the log" requirement.Verified:
jqfallback tested against a real Trivy 0.70.0 SARIF →- [error] DS-0002 security-severity=8.0 Dockerfile: …. YAML parses clean.🤖 Generated with Claude Code