ci(trivy-fs): surface the concrete findings that fail the gate#375
Closed
seonghobae wants to merge 1 commit into
Closed
ci(trivy-fs): surface the concrete findings that fail the gate#375seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
The trivy-fs job writes findings only to trivy-results.sarif, so a failing scan logs nothing but "Process completed with exit code 1" — every blocked PR had to inspect the uploaded SARIF to learn what actually failed. Add a read-only `if: failure()` step that parses the generated SARIF and prints each finding (rule id, Trivy severity, file:line, message) directly in the job log. The scan step still owns the pass/fail decision; the gate is unchanged (no severity/exit-code weakening). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RTAMs4bpSZS77Xe3RQjv9P
Contributor
Author
|
Superseded by #382, which includes this Trivy SARIF-to-log visibility fix plus central workflow token and CI regression fixes. |
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.
Problem
The central
trivy-fsjob (.github/workflows/security-scan.yml) is a HARD gate that fails PRs across the org, but it writes findings only totrivy-results.sarif. On failure the job log shows nothing but:Every blocked PR (e.g. scopeweave #285/#283/#282/#281/#279/#271/#204) had to download and parse the uploaded SARIF by hand to learn what failed. That is exactly the "check fails opaquely" anti-pattern.
Investigation (scopeweave, live)
Read the actual SARIF for the failing runs via the code-scanning analyses API (
results_count, not a stale-DB local scan). All blocked scopeweave PRs share 4 findings inherited from the default branch:DS-0026Dockerfile:1KSV-0020infra/k8s/deployment.yaml:25securityContext.runAsUser> 10000KSV-0021infra/k8s/deployment.yaml:25securityContext.runAsGroup> 10000KSV-0110infra/k8s/deployment.yaml:3metadata.namespaceThese are LOW misconfigs that leak past the job's
severity: CRITICAL,HIGHfilter under Trivy v0.70.0 in SARIF output mode (fixed upstream by 0.71.x). Remediation of the findings themselves lands at the scopeweave shared base inContextualWisdomLab/scopeweave#289(verified locally:trivy fs --scanners misconfigexits 0 on that branch).Change
Add a read-only
if: failure()step that parses the generated SARIF and prints each finding — rule id, Trivy severity,file:line, message — directly in the job log:The scan step still owns the pass/fail decision. The gate is unchanged — no severity change, no
exit-codechange, no.trivyignore. This only makes the existing failure legible.🤖 Generated with Claude Code