Guard OIDC discovery against private IPs - #6455
Merged
Merged
Conversation
Remote MCP authentication can derive an OIDC issuer from an untrusted realm. The OAuth configuration fallback previously performed discovery without the private-IP dial guard, allowing requests to loopback and private hosts. Thread the caller-selected blockPrivateIPs policy through OIDC config creation, enforce the remote flow's !AllowPrivateIPs setting, preserve private issuer access for operator-configured token sources, and add listener-based regression tests. Security-advisory: GHSA-cvhc-p56v-qm9r Reported-by: Yanhaoxi (https://github.com/Yanhaoxi)
jhrozek
requested review from
ChrisJBurns,
JAORMX,
rdimitrov and
tgrunnagle
as code owners
August 28, 2026 17:39
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6455 +/- ##
==========================================
- Coverage 78.01% 78.00% -0.01%
==========================================
Files 767 767
Lines 74147 74151 +4
==========================================
- Hits 57843 57842 -1
- Misses 16299 16304 +5
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ChrisJBurns
approved these changes
Aug 28, 2026
This was referenced Sep 8, 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.
Summary
blockPrivateIPsthrough OIDC configuration creation, apply!AllowPrivateIPsto remote OAuth discovery, and preserve private issuer support for operator-configured registry/token-source OIDC flows.Security advisory: GHSA-cvhc-p56v-qm9r
Reported by Yanhaoxi.
Type of change
Test plan
task test) — attempted, but the complete repository suite did not finish within the local timeouttask test-e2e)task lint-fix)Changes
pkg/auth/oauth/oidc.gopkg/auth/discovery/discovery.goOAuthFlowConfig.AllowPrivateIPsto fallback OIDC discovery.pkg/auth/tokensource/tokensource.gopkg/auth/oauth/oidc_test.gopkg/auth/discovery/discovery_test.goDoes this introduce a user-facing change?
Remote authentication now refuses server-derived OIDC discovery requests to private, loopback, and link-local addresses unless the configured remote target permits private upstreams.
Implementation plan
Approved implementation plan
blockPrivateIPsthroughCreateOAuthConfigFromOIDCand its private helper, replacing the hardcodedfalse.!config.AllowPrivateIPsfrom the remote discovery fallback andfalsefrom the trusted operator-configured token-source path.Special notes for reviewers
The preliminary discovery errors in
pkg/auth/remote/handler.goremain best-effort CIMD enrichment. Once this fallback uses the same private-IP policy, a failed guarded request cannot fall through to an unguarded retry. The completetask testinvocation exceeded the local execution window; CI should provide the full unit-test result.