Skip to content

[go-fan] Go Module Review: golang.org/x/vuln (govulncheck) #40020

@github-actions

Description

@github-actions

🐹 Go Fan Report: golang.org/x/vuln

Module Overview

golang.org/x/vuln ships govulncheck, Go's official vulnerability scanner. Its superpower is reachability analysis: it does symbol-level call-graph tracing so it only flags vulnerabilities your code can actually reach — far fewer false positives than version-only matching. In gh-aw it's a build-time tool, not an imported library.

Current Usage in gh-aw

  • Files: 1 source file references it — tools.go (blank import under //go:build tools).
  • Import Count: 1 (_ "golang.org/x/vuln/cmd/govulncheck").
  • Invocations: Makefile (security-govulncheck, tools targets) and .github/workflows/security-scan.yml (dedicated govulncheck job → SARIF → code scanning).
  • Key APIs Used: none — CLI only. Runs the default source / symbol-level scan over ./..., which is the recommended low-false-positive mode. 👍

Research Findings

  • Latest tag: v1.4.0, published 2026-06-17 — go.mod currently pins v1.3.0.
  • ⚠️ GitHub Releases are misleading: the last Release is v1.1.4 (Jan 2025). v1.2.0, v1.3.0, v1.4.0 ship as git tags only. Trust go list -m -versions golang.org/x/vuln, not the Releases page.

Recent Updates (v1.3.0 → v1.4.0)

  • cmd/govulncheck: fix exit code propagation for wrapped scan errorsCI-relevant: a wrapped scan error could previously mask a non-zero exit, weakening the gate.
  • Routine golang.org/x dependency bumps.

Best Practices

  • Keep the default source/symbol scan — don't switch to -scan=module (inflates false positives).
  • Emitting SARIF to code scanning (as CI does) is the recommended pattern. 👍

Improvement Opportunities

🏃 Quick Wins

  1. Collapse three conflicting version pins into one. Today govulncheck is pinned three different ways:
    • go.mod / tools.go: v1.3.0
    • Makefile tools target: v1.1.4 (≈18 months / two minor versions stale)
    • Makefile security-govulncheck: @latest (non-reproducible — local scans can diverge from CI)
  2. Bump go.mod to v1.4.0 to pick up the exit-code fix, then derive everything from it.

✨ Feature Opportunities

  1. Run via the pinned toolchain, not go install. Replace go install ...@latest`` / ...@v1`.1.4` with `go run golang.org/x/vuln/cmd/govulncheck ./...` — uses the exact go.mod version, zero drift, no separate install step.
  2. Adopt the Go 1.24+ tool directive (project is on go 1.26.3). go get -tool golang.org/x/vuln/cmd/govulncheck + go tool govulncheck ./... replaces the legacy //go:build tools + tools.go pattern, keeps the pin in go.mod, and gives Makefile and CI one invocation path.

📐 Best Practice Alignment

  • Converge the CI golang/govulncheck-action@v1.0.4 (bundles its own govulncheck) and the Makefile path onto a single pinned version so local and CI results match.

🔧 General Improvements

  • The same drift pattern affects sibling tools (e.g. actionlint pinned v1.7.11 in Makefile vs v1.7.12 in go.mod). Sourcing tool versions from go.mod via go run/go tool fixes the whole class at once.

Recommendations (prioritized)

  1. Bump golang.org/x/vulnv1.4.0 in go.mod (exit-code propagation fix).
  2. Switch Makefile security-govulncheck + tools to go run golang.org/x/vuln/cmd/govulncheck ./... (kills the @latest and v1.1.4 drift).
  3. (Optional, larger) Migrate tools.go → go.mod tool directive and use go tool everywhere.

Next Steps


Generated by Go Fan
Module summary saved to: scratchpad/mods/golang-x-vuln.md

Generated by 🐹 Go Fan ·

  • expires on Jun 19, 2026, 1:25 AM UTC-08:00

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions