fix(auth): propagate retryable OAuth discovery errors - #1072
Closed
tsarlandie-oai wants to merge 1 commit into
Closed
fix(auth): propagate retryable OAuth discovery errors#1072tsarlandie-oai wants to merge 1 commit into
tsarlandie-oai wants to merge 1 commit into
Conversation
Contributor
Author
|
Closing as a duplicate of #1071 so review, CI, and follow-up stay in one canonical draft. |
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.
Motivation and Context
Follow-up to #1069.
OAuth metadata discovery now correctly propagates transport failures and HTTP
5xx responses, but HTTP 408 Request Timeout and 429 Too Many Requests still pass
through as ordinary responses. The protected-resource and authorization-server
metadata probes then interpret those temporary failures as absent metadata. If
no later candidate succeeds, discovery can incorrectly return legacy fallback
metadata and downstream clients can conclude that OAuth is unsupported.
Treat 408 and 429 as discovery errors in the same central request path as 5xx.
This preserves the failing URL and HTTP status and stops discovery immediately,
without introducing retry policy or changing the public API.
HTTP 401 remains available for
WWW-Authenticatechallenge processing. HTTP 404and 405 continue to select subsequent discovery candidates and preserve legacy
endpoint fallback.
How Has This Been Tested?
Added six parameterized regression cases for 408 and 429 at each discovery
stage: the resource endpoint, protected-resource metadata, and authorization-
server metadata.
Verified all six cases fail on upstream
mainbefore the production fix.Asserted that each failure identifies the actual URL and status and stops
before making another request.
Parameterized the existing legacy fallback regression to independently cover
both 404 and 405 while preserving the exact discovery request sequence.
Ran the upstream all-features test suite:
rustup run 1.96 cargo test --all-featuresRan the upstream all-targets, all-features Clippy check:
Checked formatting using nightly rustfmt:
Breaking Changes
No public API or wire-format changes. OAuth metadata discovery now reports HTTP
408 and 429 as temporary failures instead of incorrectly treating them as
missing metadata.