Repository navigation
ci(security): enforce Trivy severity gates - #146
Merged
Merged
Conversation
- Fail repository and image scans on high and critical findings - Apply the declared severity threshold to SARIF reports
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.
Summary
The scheduled Trivy workflow reported success even when findings existed because it did not set a failing exit code. Enforce exit code 1 for HIGH/CRITICAL findings in both repository and image scans. Set
limit-severities-for-sarif: truein both workflows so SARIF honors the declared severity policy; keep the existing always-run report upload.No new vulnerability exclusions were added. Acceptance is the existing HIGH/CRITICAL policy, not absence of lower-severity findings.
Verification
Checkout
fix/trivy-security-scaninappleboy/drone-telegramand run from the repository root. Prerequisites: Go 1.25.13, Docker with Linux/amd64 support, Trivy 0.70.0, actionlint 1.7.12, golangci-lint 2.12.0, network access to Go modules, Alpine packages and the vulnerability database.Observed: Linux/amd64 binary and image build succeeded; both Trivy scans exited 0 with zero HIGH/CRITICAL findings using the 2026-10-06 database; actionlint, Go lint and diff checks passed. Local fs scans excluded the unrelated
.claudeworktree directory.GOTOOLCHAIN=go1.25.13 go test -timeout 180s ./...: passed.Negative gate check passed: scanning a temporary module requiring x/crypto v0.45.0 with
trivy fs --scanners vuln --severity HIGH,CRITICAL --exit-code 1 --format sarifreturned exit 1 and still emitted SARIF findings. This validates the failure/report path. Review the retainedif: always()upload steps. PR CI validates GitHub SARIF upload separately.Cleanup: generated binaries are ignored under
release/; the optional local image can be removed withdocker image rm drone-telegram:trivy-fix.AI authorship and review
.github/workflows/docker.yml,.github/workflows/trivy.yml.Scope, risk and rollback
Goal: remediate current scan findings and make recurring scans enforce the declared severity threshold. Risk: dependency/toolchain updates may affect runtime behavior; newly published HIGH/CRITICAL advisories will now correctly fail CI. Revert this commit to roll back, which also restores the previous security weaknesses. Review workflow gates and dependency/image version changes carefully; checksums are mechanical.
Related issues: none supplied.