fix(mpp): match auth-param names case-insensitively - #121
Open
memosr wants to merge 1 commit into
Open
Conversation
parseAuthParams keyed the params map on the raw auth-param name, so the RFC 9110 §11.2 rule its own doc comment cites was never applied. A fully valid mixed-case challenge was rejected with "missing required challenge fields", and a duplicate hidden by case (id="a", ID="b") slipped past the duplicate guard, silently yielding "a" while a normalizing peer reads "b". Lowercase the name token only. Values are left verbatim, so case-sensitive data such as challenge IDs and base64url payloads is preserved, and the unescaped-quote tolerance now keys off the normalized "description" name.
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.
parseAuthParamskeys the params map on the raw name token, so RFC 9110 §11.2 — which its own doc comment cites — is never applied:Two consequences:
missing required challenge fields.Payment id="a", ID="b", ...parses and silently yieldsa, while a peer that normalizes names readsb.The asymmetry sits inside one function:
ParseChallengealready applies §11.1 withstrings.EqualFold(scheme, "Payment"), then hands the rest to a parser that compares names byte for byte. The conformance suite pins both halves of the rule,case_insensitive_schemefor the scheme anderror_duplicate_parametersfor duplicate names; mpp-go passes both literally while the duplicate guard stays bypassable.Only the name token is lowercased. Values are left verbatim so challenge IDs and base64url payloads keep their case, and
uppercase method value is still rejectedguards that boundary: lowercasing the whole pair would turnMETHOD="Tempo"into a valid method name.Written test first. Seven of the eight subtests fail against the current parser;
duplicate name in the same case is still rejectedpasses before and after as a regression guard.