Stage 1 · Code
Advanced Runtime & Tooling
Dependency & Supply-Chain Security
Treat modules, build tools, and release artifacts as inputs that must be verified—not as trusted code merely because `go get` succeeded.
Your Dependency Graph Is a Trust Boundary
A Go binary may look self-contained, but its source can include hundreds of packages written outside your repository. A compromised module, an unreviewed upgrade, or a floating build-tool version can change the binary even when your application code did not. Supply-chain security starts by making those inputs visible and reproducible.
go.sum helps prove that a module version matches the content previously recorded by the checksum database. It does not prove the code is bug-free, maintained, or appropriate for your threat model. Integrity verification and vulnerability analysis solve different problems.
Verify What Go Downloaded
Upgrade one direct dependency at a time, read its release notes, rerun tests, and review transitive changes. go get -u ./... is intentionally not the default here because a bulk upgrade makes failures and security-impacting changes harder to attribute.
Find Reachable Vulnerabilities
| Finding | Meaning | Response |
|---|---|---|
| Module is listed | A dependency version has a known advisory | Read the advisory and affected symbols |
| Vulnerable symbol is reachable | Your code can call the affected path | Upgrade or mitigate before release |
| Vulnerable symbol is not called | Exposure is lower, not zero | Plan the upgrade and document the decision |
| No findings | No known reachable issue in the current database | Keep scanning; absence of evidence is not a guarantee |
Pin Build Tools and Produce an SBOM
Enforce the Policy in CI
name: dependency-security
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26.x"
cache: true
- run: go mod verify
- run: go test ./...
- run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.4
- run: govulncheck ./...The workflow grants read-only repository access, verifies module content, proves behavior, and scans reachable code. Pin the scanner to the version your team has reviewed, then update that pin deliberately.
If a finding cannot be fixed immediately, document the advisory, reachability, compensating control, owner, and expiry date. A broad ignore flag turns a temporary exception into invisible permanent risk.
What does `go mod verify` establish?
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.