Remove GOINSECURE from gomod patch generation#1126
Merged
cpuguy83 merged 1 commit intoJul 3, 2026
Conversation
The gomod replace/tidy preprocessing step set GOINSECURE to the same host list as GOPRIVATE, silently disabling TLS verification for those hosts. It was inert for SSH auth (insteadOf rewrites bypass Go's HTTP client) and was never set in the dependency download step, so it enabled no working scenario while weakening certificate validation. GOPRIVATE is retained for module privacy. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes use of GOINSECURE from the go.mod patch/tidy preprocessing path so the preprocessing step no longer disables TLS certificate verification for private module hosts. This aligns behavior with the rest of the build pipeline (which already wasn’t setting GOINSECURE) while keeping GOPRIVATE for proxy/sumdb privacy behavior.
Changes:
- Stop exporting/propagating
GOINSECUREin the gomod patch generation environment. - Keep
GOPRIVATEhost calculation/export as the only Go module privacy-related env var for this step. - Update the gomod patch script’s documented expected environment variables accordingly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/gomod-patch.sh | Removes GOINSECURE from the documented/handled env vars; retains GOPRIVATE export only. |
| preprocess.go | Removes goInsecure derivation and no longer sets env["GOINSECURE"] for the gomod patch script. |
invidian
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The gomod replace/tidy preprocessing step set
GOINSECUREto the same host list asGOPRIVATE, silently disabling TLS certificate verification for those hosts.Investigating its actual behavior:
insteadOfrewrite redirects tossh://before Go's HTTP client is involved, so there is no TLS path forGOINSECUREto affect.generator_gomod.go). A private HTTPS host with an untrusted cert would still fail there, so the setting never enabled a working end-to-end scenario.In short, it weakened certificate validation without enabling any working behavior. This removes it.
GOPRIVATEis retained, so module privacy (skipping proxy/sumdb for the configured hosts) is unchanged.