Skip to content

Parse WWW-Authenticate schemes and parameter keys case-insensitively - #985

Open
acmcelwee wants to merge 1 commit into
apple:mainfrom
acmcelwee:fix-auth-case-sensitivity
Open

acmcelwee wants to merge 1 commit into
apple:mainfrom
acmcelwee:fix-auth-case-sensitivity

Conversation

@acmcelwee

@acmcelwee acmcelwee commented Oct 22, 2026 •

Copy link
Copy Markdown

RFC 9110 §11.1 and §11.2 specify that HTTP authentication schemes and parameter names are case-insensitive tokens. Previously, RegistryClient matched schemes case-sensitively against "Bearer" and "Basic" and looked up parameter keys with their as-received casing, breaking container registry login and container image pull against registries like Sonatype Nexus that send WWW-Authenticate: BASIC realm="...".

  • Lowercase schemes and parameter keys in RegistryClient.parseWWWAuthenticateHeaders.
  • Compare against "bearer" and "basic" in RegistryClient and RegistryClient+Token.
  • Include the offered schemes in the missing-Bearer error message in createTokenRequest.
  • Add unit tests in AuthChallengeTests for uppercase schemes and mixed-case parameter keys, and parameterize the TLS Basic challenge test in RealmRequestTests across Basic, BASIC, and basic.

Fixes #984

@acmcelwee
acmcelwee force-pushed the fix-auth-case-sensitivity branch 2 times, most recently from 0957317 to f9961cc Compare October 22, 2026 19:42
RFC 9110 §11.1 and §11.2 specify that HTTP authentication schemes and parameter
names are case-insensitive tokens. Previously, RegistryClient matched schemes
case-sensitively against "Bearer" and "Basic" and looked up parameter keys
with their as-received casing, breaking login and pull against registries like
Sonatype Nexus that send "WWW-Authenticate: BASIC realm=...".

- Lowercase schemes and parameter keys in parseWWWAuthenticateHeaders.
- Compare against "bearer" and "basic" in RegistryClient and
  RegistryClient+Token.
- Include the offered schemes in the missing-Bearer error message.
- Add unit tests in AuthChallengeTests for uppercase schemes and mixed-case
  parameter keys, and parameterize the TLS Basic challenge test in
  RealmRequestTests across Basic, BASIC, and basic.

Fixes apple#984
@acmcelwee
acmcelwee force-pushed the fix-auth-case-sensitivity branch from f9961cc to 1e8e897 Compare October 22, 2026 19:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Case-sensitive WWW-Authenticate scheme and parameter matching breaks login/pull for registries sending uppercase BASIC

1 participant