Repository navigation
fix(challenge): require comma-separated auth-params and token values (mppx#1349) - #758
brendanjryan wants to merge 2 commits into
Conversation
👁️ Cyclops Security Review✅ Reviewed 2dccdda (latest) · Coverage: partial · no open findings · report |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
✅ Changelog found on PR. |
Motivation
mppx now reads a Challenge's auth-params by the core grammar,
auth-params = auth-param *( OWS "," OWS auth-param )with RFC 9110tokenfor 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:realm="p"ay.example.com:8443"(read as realmp, with the rest dropped), or a word after the last auth-param with no comma before it;realm=,or a trailingdescription=, which mpp-rs read as"".Summary
read_challengerejects a Challenge when another token follows its last auth-param with no comma between them ("Malformed auth-param: expected ',' after a value"). TheTokenizergets aglued()read-ahead that consumes nothing.realm=,anddescription=fail with "Invalid auth-param value". An empty quoted value (description="") still reads as"".test_parse_www_authenticate_keeps_empty_trailing_parambecomestest_parse_www_authenticate_rejects_empty_unquoted_value.Key design considerations
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.parse_www_authenticate(single) still requiresPaymentto be the first scheme, as before;parse_www_authenticate_allfinds it anywhere. Unchanged here.Verified:
cargo fmt --check,cargo clippy --workspace --all-targets --all-features -D warnings,cargo test --lib --bins --testsand--docwith the AGENTS.md feature list,typos, ast-grep scan and test.Propagated from wevm/mppx#1349 (8a31e2d6083b741bfa2c5492cd1d317cdf931a23) by Agricola.