Skip to content

fix(challenge): require comma-separated auth-params and token values (mppx#1349) - #758

Closed
brendanjryan wants to merge 2 commits into
mainfrom
agricola/mppx-1349
Closed

brendanjryan wants to merge 2 commits into
mainfrom
agricola/mppx-1349

Conversation

@brendanjryan

Copy link
Copy Markdown
Collaborator

Source: wevm/mppx#1349 (merge commit 8a31e2d)

Motivation

mppx now reads a Challenge's auth-params by the core grammar, auth-params = auth-param *( OWS "," OWS auth-param ) with RFC 9110 token for unquoted values, and rejects anything else as a malformed auth-param. #752 already brought most of that to mpp-rs (commas between auth-params, token names and values), but two cases still parsed here while mppx rejects them:

  • text right after a closing quote, such as realm="p"ay.example.com:8443" (read as realm p, with the rest dropped), or a word after the last auth-param with no comma before it;
  • an empty unquoted value, such as realm=, or a trailing description=, which mpp-rs read as "".

Summary

  • read_challenge rejects a Challenge when another token follows its last auth-param with no comma between them ("Malformed auth-param: expected ',' after a value"). The Tokenizer gets a glued() read-ahead that consumes nothing.
  • An unquoted value must be a non-empty token, so realm=, and description= fail with "Invalid auth-param value". An empty quoted value (description="") still reads as "".
  • Tests mirror mppx's: the malformed lists, token values with OWS around commas, and Payment beside other schemes in one field value. test_parse_www_authenticate_keeps_empty_trailing_param becomes test_parse_www_authenticate_rejects_empty_unquoted_value.

Key design considerations

  • The check lives in read_challenge, not the tokenizer, so other schemes in the same field value (Basic realm="x", Bearer token68==) are read as before and a Payment Challenge beside them still parses.
  • This rejects headers mpp-rs used to accept, but only ones mppx, the reference SDK, now rejects too, so a patch release note.
  • parse_www_authenticate (single) still requires Payment to be the first scheme, as before; parse_www_authenticate_all finds it anywhere. Unchanged here.

Verified: cargo fmt --check, cargo clippy --workspace --all-targets --all-features -D warnings, cargo test --lib --bins --tests and --doc with the AGENTS.md feature list, typos, ast-grep scan and test.

Propagated from wevm/mppx#1349 (8a31e2d6083b741bfa2c5492cd1d317cdf931a23) by Agricola.

@tempoxyz-bot

tempoxyz-bot commented Nov 25, 2026 •

Copy link
Copy Markdown

👁️ Cyclops Security Review

✅ Reviewed 2dccdda (latest) · Coverage: partial · no open findings · report
⚠️ Not checked: Malformed Payment Challenge reaches client offer selection: ruled out without reading the cited code at this commit
⚠️ Not checked: Proxy forwards a residual Payment challenge after stricter parsing: ruled out without reading the cited code at this commit
ℹ️ Not verifiable from the source alone (needs running code or deployed state): The new delimiter probe repeats lookahead over delimiter or whitespace runs supplied in a Challenge header. The source establishes the extra pass, not a 2x increase in end-to-end parsing time or peak

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T15:33:34.895685Z 4b313bc 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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Changelog found on PR.

Edit changelog

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread .changelog/strict-auth-param-list.md Resolved

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

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