Repository navigation
oauthex: accept empty list elements in WWW-Authenticate - #1351
Merged
guglielmo-san merged 2 commits intoOct 19, 2026
Merged
guglielmo-san merged 2 commits into
guglielmo-san merged 2 commits into
Conversation
RFC 9110, section 5.6.1.2, requires a recipient to accept empty list
elements, such as the extra comma in "a=1,, b=2". ParseWWWAuthenticate
did not: after a second comma, splitChallenges saw ", b=2" as the start
of a new challenge, so
Bearer realm="x",, resource_metadata="https://..."
parsed as a Bearer challenge without resource_metadata plus a challenge
with scheme ",". An empty element right after the scheme
("Bearer ,realm=x") produced a parameter named ",realm".
Skip empty list elements both where splitChallenges looks ahead after a
comma and where parseSingleChallenge consumes one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 9, 2026
guglielmo-san
approved these changes
Oct 19, 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.
RFC 9110, section 5.6.1.2, requires a recipient to accept empty list elements, such as the extra comma in
a=1,, b=2.ParseWWWAuthenticatedid not.After a second comma,
splitChallengessaw, b=2as the start of a new challenge, so a server sendingparsed as a Bearer challenge without
resource_metadata, plus a second challenge with scheme",".AuthorizationCodeHandler.Authorizethen never saw the resource metadata URL from the challenge. An empty element right after the scheme (Bearer ,realm="x") produced a parameter named,realm.This skips empty list elements both where
splitChallengeslooks ahead after a comma and whereparseSingleChallengeconsumes one.Tests (each fails without the change):
TestParseWWWAuthenticateEmptyListElements: empty elements before, between and after params and between challenges keepresource_metadataon the Bearer challenge.TestSplitChallenges: an empty element between params does not split the challenge.TestParseSingleChallenge: empty elements around params are ignored.AI assistance: prepared with Claude Code.
🤖 Generated with Claude Code