Repository navigation
Conversation
Align main with the secure-default metadata-free fallback adaptation from release/1.x without changing discovered metadata validation or callback behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove in-process AppContext mutations and class-wide serialization. Retain secure-default regression coverage and existing subprocess conformance opt-in. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
tarekgh
approved these changes
Oct 25, 2026
Contributor
|
The markdown failure will be fixed in another PR. I think we are good to merge. |
This branch has not been deployed
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
Align main with the focused no-metadata fallback adaptation in #1949, without stacking on or importing the release/1.x backport. That PR is unchanged.
Main already includes #1700's PKCE metadata verification and #1605/#1726's issuer/state validation. This change only disables the automatic synthetic OAuth metadata fallback unless explicitly enabled:
resourceUri is null) and no authorization server metadata document is discovered, reject authentication before requesting authorization or exchanging tokens by default.ModelContextProtocol.Authentication.AllowLegacyOAuthMetadataFallbackAppContext switch is explicitlytrue. The switch value is not cached; using the fallback logs a warning./authorize,/token, and/registerdefaults and existing S256 challenge/verifier behavior. Discovered metadata that omits S256 or advertises only plain remains rejected, even when the switch is enabled; a later eligible discovery endpoint can still succeed.Compatibility tightening and escape hatch
Intentional compatibility impact: metadata-free legacy OAuth deployments that previously relied on synthetic endpoint defaults now fail by default. Deployments already authenticating through valid discovered metadata are unaffected by this incremental change. This is not a new provider compatibility rule for discovered metadata.
A trusted legacy deployment can explicitly opt in at application startup:
The switch is disabled when absent or
false. Enabling it is not assurance of PKCE support. Hosts must independently establish that their trusted authorization server correctly enforces PKCE, including downgrade defenses. The switch affects every OAuth client in the process, not a per-server allowlist; do not enable it alongside untrusted authorization servers or toggle it around individual requests. Prefer fixing discovery and advertising S256.The API remarks, transport guide, and protected-client sample document this tightening and escape hatch. The conformance client opts in only for its trusted
auth/2025-03-26-oauth-endpoint-fallbackscenario; other scenarios retain secure defaults. Existing conformance expectations remain unchanged.Rationale
RFC 9700 §2.1.1 and §4.7.1 allow deployment-specific assurance of PKCE support, but synthesizing S256 after discovery fails is not assurance. State validation protects response correlation/CSRF; it does not prevent direct redemption of an intercepted authorization code. PKCE remains necessary, particularly for native public clients. Main also retains the obsolete code-only callback, whose behavior this PR does not change.
This is a narrow secure-default alignment, not a claim of an established exploit or an emergency affecting all existing clients.
Validation
dotnet build --no-restore --nologo --verbosity quiet: zero warnings/errors.AuthTestsno longer mutates AppContext or disables parallelization; redundant absent/false/true permutations and dedicated in-process opted-in success/warning assertions were removed rather than skipped.auth/2025-03-26-oauth-endpoint-fallbackconformance scenario exercises successful opt-in in a subprocess. Explicit-false permutations, warning emission, and invalid-metadata rejection while opted in are no longer separately asserted in-process. No new subprocess infrastructure or changes to conformance expectations were introduced.Validation used pinned npm dependencies and a test-process-only current-directory PATH entry for Windows process tests; no machine settings or repository test behavior were changed.
Note
This PR and its description were generated with GitHub Copilot.