Docs / Reference
ADR 0086 - Vulnerability scanning in CI
Status: Accepted (delegated review, 2026-11-25)
Context
Graphvein ships one Go binary with the web UI embedded. Before the public
launch the developer decided (2026-11-24) that CI scans both dependency
trees for known vulnerabilities: the Go modules and standard library linked
into graphvein, and the npm packages of the web UI (web/), whose
production dependencies are bundled into the embedded UI.
Constraints:
- The repository uses Go 1.27.1. govulncheck v1.10.0 (the current release)
cannot type-check Go 1.27 sources: source mode (
govulncheck ./...) stops with errors in the toolchain's own packages, for exampleinternal/poll/splice_linux.go:237:21: use of promoted field splicePipeFields.rfd in struct literal of type splicePipe requires go1.27 or laterandmath/rand/v2/rand.go:213:18: generic method requires go1.27 or later(checked 2026-11-24, govulncheck built with Go 1.27.1). - The repository is private and CI minutes are budgeted: a scan should add seconds, not a job.
scripts/test.shruns offline; a vulnerability scan needs its database (vuln.go.dev, the npm registry).- Scripts run in Git Bash, bash 3.2 and Linux.
Options considered
- govulncheck source mode. Call-graph precision (reports only vulnerabilities whose symbols the code reaches). Not usable: it cannot load Go 1.27 sources yet.
- govulncheck binary mode on the built binary. Works with any Go version the binary was built with; reports a vulnerability when a vulnerable symbol is linked into the binary. Less precise than source mode (a linked symbol need not be reachable from Graphvein's code), but it scans exactly what ships.
- A third-party scanner (OSV-Scanner, Trivy, Snyk). One tool for both trees, but a new dependency or service, coarser module-level results for Go, and for Snyk an account.
- GitHub Dependabot alerts and dependency review. Free for public repositories and covers both ecosystems, but needs repository settings rather than code and does not gate a branch push the way a CI step does.
- npm audit for the web tree: built into the pinned npm, reads only
web/package-lock.json, no install needed.
Decision
Options 2 and 5, in one script, scripts/vulncheck.sh (go, web, or
both), run as two steps of CI's Linux postgres job:
- Go: the script installs govulncheck at a pinned version (v1.10.0)
with the repository's toolchain into
bin/tools, scans the builtbin/graphveinwith-mode=binary -format json, and passes the result to a small gate,scripts/vulncheck(Go, standard library only). The gate fails when a vulnerable symbol is linked into the binary and no reviewed, unexpired entry ofscripts/vulncheck/allowlist.txtcovers the finding. Package- and module-level findings (vulnerable code in an imported package or required module that is not linked in) are reported and do not fail. - Allowlist: one line per entry,
ID EXPIRY REASON; the ID is a Go vulnerability ID, the expiry a date. An entry covers its finding through its expiry day; after that it fails the gate itself until it is reviewed or removed. Malformed lines fail (a typo never widens the list), and an entry that matches no finding is reported for removal. The offline suite checks that the committed file parses. - Web:
npm audit --omit=dev --audit-level=highfails on high or critical advisories in production dependencies; a second, fullnpm auditreports every other advisory without failing. It runs only when the web check runs (scripts/ci-changes.shoutputweb, which now also coversscripts/vulncheck.sh). - Placement: the Go scan runs after the build step on every run of the
job; the web audit runs after the web check. Neither is in
scripts/test.sh, because both need the network. Developers runbash scripts/vulncheck.shlocally.
Consequences
- Every gate run checks the shipped binary against the current Go vulnerability database. A new advisory can turn a run red without a code change; that is intended, and the fix is a dependency bump or a reviewed, expiring allowlist entry.
- Added CI time, measured 2026-11-24 on a 4-CPU Linux machine with a cold build cache: about 19 s for the Go scan (most of it compiling govulncheck and the gate) and about 3 s for the web audit. Within the job's existing whole-minute billing this is usually free and at most one more minute.
- The first scan (2026-11-24) found 13 vulnerabilities with linked
symbols: 11 in the Go 1.27.1 standard library (fixed by go1.27.2 to
go1.27.4) and 2 in
golang.org/x/textv0.29.0 (fixed in v0.39.0 and v0.41.0). They are allowlisted with a two-week expiry while the fixes are decided: the toolchain bump is a separate change, and thex/textbump moves the Python extractor's NFKC and rune-name tables from Unicode 15 to Unicode 17 under Go 1.27, which is a claim contract change (ADR 0069). Both are fixed since (Known gaps, "First-scan findings fixed"). - npm audit found no advisory in production dependencies; 9 moderate
advisories in development dependencies (one
minimatchadvisory through eslint and typescript-eslint) are reported only.
Known gaps
- Binary mode precision: it reports linked symbols, not reachable ones, so it can flag code Graphvein never calls (over-reporting, never under-reporting what is linked). Revisit source mode once govulncheck supports Go 1.27.
- Go only covers the binary: test-only dependencies, the parsing spike module and build tools are not scanned.
- npm audit covers advisories in the GitHub advisory database for the locked versions only; development dependencies never fail the gate.
- Dependabot and GitHub advisories: at the public launch, enable
Dependabot alerts and security updates, dependency review on pull
requests, and private vulnerability reporting (already described in
SECURITY.md). These are repository settings, outside this change. - No scheduled scan: a scan runs only when CI runs, so a new advisory
against an unchanged
mainis noticed at the next gate run (or by Dependabot after launch). - The scans need network access to vuln.go.dev and the npm registry; an outage fails the step.
- First-scan findings fixed: the 11 standard library findings of the
first scan were fixed by moving the toolchain to go1.27.4 (the
toolchainline ingo.mod; the language version stays 1.27.1), and the twogolang.org/x/textv0.29.0 findings (GO-2026-5970, GO-2026-6629) by movingx/textto v0.41.0 (2026-11-24). That bump moves the Python extractor's NFKC and rune-name tables from Unicode 15 to Unicode 17, newer than the reference CPython 3.14's Unicode 16; ADR 0069's revision of 2026-11-24 refuses the files whose claims would depend on the difference. The allowlist holds no entry, andscripts/vulncheck.sh goreports no finding. - Dependency bumps can be contract changes: a module whose data a claim contract depends on (Unicode tables here) cannot be bumped as a plain fix; the fix waits for the contract revision while an expiring entry covers the finding.
Review notes (2026-11-25)
- Results: gate run 45481900427 (Linux and Postgres; 0 FAIL, 253
/postgresPASS); first CI run of the new steps. Findings at introduction: 11 standard-library (fixed by the Go 1.27.4 toolchain) and 2 golang.org/x/text (fixed by v0.41.0 with the ADR 0069 Revision 1 refusal rule); the allowlist is empty; npm audit: no production findings, 9 moderate development-only. - Known gaps: as listed above; Dependabot, dependency review and GitHub security advisories at the public launch.
Report a problem with this pageSource: docs/adr/0086-vulnerability-scanning.md