ci: gate PRs on govulncheck - #224
Open
peatey wants to merge 2 commits into
Open
Conversation
We generate SBOMs on every PR but never fail on a vulnerability. sbom.yml runs trivy twice purely for inventory (spdx-json and cyclonedx), and pr.yaml covers tests, lint, build and e2e. Nothing blocks a PR that introduces a known-vulnerable dependency. The existing security tooling covers other axes: CodeQL (via GitHub default setup), Mend SAST, and GitGuardian are all SAST or secrets. Dependency vulnerabilities were the uncovered one, which is how klauspost/compress and go.opentelemetry.io/otel sat at versions with published advisories until they were found by hand. Adds a govulncheck job. It was chosen over a trivy gate specifically for its failure mode: govulncheck does reachability analysis and fails only when our code actually calls a vulnerable symbol. Advisories in modules we merely require are reported without failing. That distinction matters here. We carry three advisories that cannot be fixed by any version bump: GO-2026-5932 golang.org/x/crypto openpgp, unmaintained GO-2022-0646 aws-sdk-go v1 s3crypto CBC padding oracle GO-2022-0635 aws-sdk-go v1 s3crypto in-band key negotiation All are Fixed in: N/A, and aws-sdk-go v1 stays in the graph regardless of our own code because opencost's cloud provider package imports it. A scanner that failed on unreachable findings would be red from day one and would need a permanently maintained ignore list. Verified against both develop and the current dependency branch: govulncheck exits 0 on each, so this gate is green on arrival and has no ordering dependency on the in-flight dependency PR. The job runs independently of build-and-test rather than as a step inside it, so a failing unit test cannot mask a vulnerability or vice versa. It inherits this workflow's nightly cron, which is where most of the value sits: newly published advisories get caught against unchanged code instead of waiting for someone to open a PR. govulncheck is pinned to v1.6.0 rather than @latest so the scanner cannot change under a review in progress. This does not stale the data, as the advisory database is fetched from vuln.go.dev at run time. set-labels is deliberately left untouched. Its needs list drives a label that reads "unit tests passed/failed", and wiring a vulnerability result into it would make that label mean something it does not say. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Aug 6, 2026
jessegoodier
reviewed
Aug 6, 2026
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v5 |
Contributor
There was a problem hiding this comment.
i see v7 is current. any reason to not use it?
https://github.com/actions/setup-go/tags
Contributor
There was a problem hiding this comment.
I see it is all over this file. nevermind. future PR.
jessegoodier
approved these changes
Aug 6, 2026
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
We generate SBOMs on every PR but never fail on a vulnerability.
sbom.ymlrunstrivy twice purely for inventory (
spdx-json,cyclonedx);pr.yamlcoverstests, lint, build and e2e. Nothing blocks a PR that introduces a
known-vulnerable dependency.
The existing tooling covers other axes — CodeQL (GitHub default setup), Mend
SAST, GitGuardian — but those are all SAST or secrets. Dependency
vulnerabilities were the uncovered one, which is exactly how
klauspost/compressandgo.opentelemetry.io/otelsat at versions withpublished advisories until they were found by hand in #223.
Why govulncheck rather than trivy
Chosen for its failure mode. govulncheck does reachability analysis and
fails only when our code actually calls a vulnerable symbol; advisories in
modules we merely require are reported without failing the job.
That distinction is what makes this gate viable. We carry three advisories that
no version bump can fix:
golang.org/x/cryptoopenpgp, unmaintainedaws-sdk-gov1 s3crypto CBC padding oracleaws-sdk-gov1 s3crypto in-band key negotiationaws-sdk-gov1 stays in the module graph regardless of our own code, becauseopencost/pkg/cloud/providerimports it. A scanner that failed on unreachablefindings would be red from day one and need a permanently maintained ignore
list that quietly rots.
I originally suggested
trivy fs --exit-code 1as well, then tested it:Dropped verbatim, that job never goes green. It would need
ignore-unfixed: trueplus a severity floor to be usable. Left out of this PRto keep it to one clean change — worth revisiting as a second opinion later,
since trivy catches things govulncheck won't (notably OS-package CVEs in the
ubi9-micro base image).
Verification
Confirmed green before opening, on both relevant bases:
So the gate is green on arrival and has no ordering dependency on #223 — it
can merge before or after.
Workflow YAML parsed and the job graph checked:
vuln-scanhas noneedsandruns in parallel;
build-and-test,e2e-testandset-labelsare untouched.Design notes for reviewers
build-and-test— so a failing unit test cannot mask a vulnerability, or vice versa.govulncheck@v1.6.0, not@latest, so the scanner cannot change under a review in progress. This does not stale the data — the advisory database is fetched from vuln.go.dev at run time, so a pinned binary still sees new advisories. (v1.6.0 is the current latest.)set-labelsdeliberately untouched. Itsneedslist drives a label reading "unit tests passed/failed"; wiring a vulnerability result into it would make that label mean something it doesn't say. Happy to change if you'd rather it gate the label too.path: ./ibm-finops-agentconvention the other jobs use, since this job is self-contained and the nested path buys nothing here. Easy to align if you prefer consistency.If you want this as a required check, that's a branch-protection setting rather
than anything in this file.
Not included
Adjacent supply-chain hardening from the same review, deliberately left for a
separate pass so this PR stays reviewable:
.golangci.yamlhas nogosec— would have caught the missingReadHeaderTimeout(G112) andos.MkdirAll(path, os.ModePerm)= 0777 (G301)actions/checkout@v6,docker/build-push-action@v6,azure/setup-helm@v1); onlytrivy-actionis pinnedMakefile:20runssetup-envtest@latestunpinned in CIDockerfile:25usesredhat/ubi9-micro:latest(trivy DS-0001)sbom.yml:44interpolates${{ inputs.release_version }}straight into arun:block — script injection for anyone withworkflow_dispatch