How to fix: Go go.mod exposed
The response is a Go module file: a module directive followed by a go language-version directive.
Why it matters
The module path is frequently a private repository URL, which discloses an internal git host and the organisation's internal module naming. The require block gives every direct dependency and version, and the go directive pins the toolchain version, which reveals whether the build predates a known Go runtime fix.
Go binaries are statically linked and ship without go.mod, so a served copy means the source tree is under the document root rather than just the built binary. Where the module path names a private host, the more useful follow-up is dependency confusion: an internal module path that is not reserved on the public proxy can be claimed by someone else.
How to fix it
- 1Deploy the compiled binary, not the source tree.
- 2Check whether the internal module path disclosed here is claimable on proxy.golang.org, and reserve it if so.
- 3Set GOPRIVATE / GONOSUMDB for internal module prefixes so the toolchain never resolves them through the public proxy.
- 4Run govulncheck against the module now that its dependency set is public.
Code examples
Keep internal modules off the public proxy
go env -w GOPRIVATE=git.internal.example.com/*
go env -w GONOSUMCHECK=1Audit the module
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...References
Detected automatically by VulnRadar. The check id is supply-chain-go-mod-exposed, stable across every scan so you can filter or diff on it.
More supply chain checks
- Mediumnpm/yarn Lock File Exposed
- MediumPython Requirements File Exposed
- MediumRuby Gemfile or Gemfile.lock Exposed
- MediumExternal CDN Script Without SRI Hash
- HighHTTP Script Loaded on HTTPS Page
- MediumPHP composer.json or composer.lock Exposed
- HighDockerfile or docker-compose.yml Exposed
- Critical.env File Exposed at Public URL
Questions
- How severe is Go go.mod exposed?
- VulnRadar rates this low severity in the supply chain category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id supply-chain-go-mod-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Go go.mod exposed map to?
- It maps to CWE-540. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.