Skip to content

Add GONOPROXY/GONOSUMDB env vars to go_modules FileParser#15159

Open
Nishnha wants to merge 1 commit into
mainfrom
nishnha/go-gonoproxy-cross-org-fix
Open

Add GONOPROXY/GONOSUMDB env vars to go_modules FileParser#15159
Nishnha wants to merge 1 commit into
mainfrom
nishnha/go-gonoproxy-cross-org-fix

Conversation

@Nishnha
Copy link
Copy Markdown
Member

@Nishnha Nishnha commented May 27, 2026

Adds support for two new options in FileParser:

  • :gonoproxy → sets ENV["GONOPROXY"]
  • :gonosumdb → sets ENV["GONOSUMDB"]

Both follow the same bail-out pattern as :goprivate (skip if user supplied their own go.env with the same key). :gonoproxy additionally bails when goproxy_credentials is set, since a custom proxy server overrides proxy routing decisions.

Why

Today the consumer (dependabot-api) sets GOPRIVATE=* to make cross-org private modules work. GOPRIVATE doubles as the default for GONOPROXY and GONOSUMDB, so every public module also bypasses proxy.golang.org and triggers a full git clone — causing disk exhaustion on the updater (see github/dependabot-updates#13395).

Go treats GONOPROXY and GONOSUMDB as independent overrides. From Go's own test suite (src/cmd/go/testdata/script/mod_gonoproxy.txt):

env GONOPROXY=none # that is, proxy all despite GOPRIVATE

With this change, dependabot-api can send GOPRIVATE=*, GONOPROXY=none, GONOSUMDB=* so public modules cache through the proxy while private/cross-org modules fall back to direct git auth with sumdb skipped.

Companion API PR: https://github.com/github/dependabot-api/pull/8337.

Rollout

No ordering required. Older API versions only send :goprivate; this PR is purely additive on FileParser.

GOPRIVATE=* forces every module through git auth, bypassing
proxy.golang.org. That fixes cross-org private fetches but causes
the updater to clone full repos for every public dep, exhausting disk.

Go treats GONOPROXY and GONOSUMDB as independent overrides — GOPRIVATE
is just their default. See src/cmd/go/testdata/script/mod_gonoproxy.txt:
  env GONOPROXY=none # that is, proxy all despite GOPRIVATE

This lets the API send GOPRIVATE=*, GONOPROXY=none, GONOSUMDB=* so
public modules cache via the proxy while private/cross-org modules
fall back to direct git auth with sumdb skipped.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 27, 2026 21:10
@Nishnha Nishnha requested a review from a team as a code owner May 27, 2026 21:10
@github-actions github-actions Bot added the L: go:modules Golang modules label May 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Go modules FileParser environment setup so Dependabot can independently configure Go proxy and checksum database routing via GONOPROXY and GONOSUMDB.

Changes:

  • Adds :gonoproxy and :gonosumdb option handling in the Go modules file parser.
  • Preserves existing go.env and custom proxy credential precedence rules.
  • Adds specs covering setting, omitting, and not overriding the new environment variables.
Show a summary per file
File Description
go_modules/lib/dependabot/go_modules/file_parser.rb Adds environment variable setup for GONOPROXY and GONOSUMDB.
go_modules/spec/dependabot/go_modules/file_parser_spec.rb Adds parser initialization specs for the new options and precedence behavior.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: go:modules Golang modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants