Skip to content

Trim whitespace around WWW-Authenticate directives - #1377

Merged
yzhuang-oai merged 1 commit into
openai:mainfrom
nicoloangileri:fix-www-authenticate-ows
Oct 17, 2026
Merged

yzhuang-oai merged 1 commit into
openai:mainfrom
nicoloangileri:fix-www-authenticate-ows

Conversation

@nicoloangileri

Copy link
Copy Markdown
Contributor

WWWAuthenticate splits the challenge on commas but keeps the whitespace around each directive. RFC 7235 allows it (Bearer realm="...", service="...", scope="..."), and with that header service and scope end up stored as " service" and " scope". Registry.auth then looks them up by their plain names, so the token request goes out without them. With a space before a comma the value also keeps its closing quote.

Now the key and the value are trimmed before the quotes are stripped. Added a parser test, and a spaced mode to RegistryRealmTests that checks the token endpoint still receives service and scope.

Same bug as #1258, which was closed by its author without a fix.

RFC 7235 allows optional whitespace around the commas that separate
auth-params, e.g. `Bearer realm="...", service="...", scope="..."`.
The parser kept that whitespace in the keys, so "service" and "scope"
were stored as " service" and " scope" and were never sent to the
token endpoint.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T00:13:07.362755Z 054fc89 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@yzhuang-oai
yzhuang-oai merged commit 8955b9f into openai:main Oct 17, 2026
1 check passed
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.

2 participants