Skip to content

fix(parsing): reject malformed auth params#14

Open
EfeDurmaz16 wants to merge 1 commit into
stripe:mainfrom
EfeDurmaz16:fix/reject-malformed-auth-params
Open

fix(parsing): reject malformed auth params#14
EfeDurmaz16 wants to merge 1 commit into
stripe:mainfrom
EfeDurmaz16:fix/reject-malformed-auth-params

Conversation

@EfeDurmaz16
Copy link
Copy Markdown

Summary

Reject malformed WWW-Authenticate: Payment auth-param lists instead of silently accepting partial regex matches.

This catches cases where required params are present but the header is still malformed, for example:

  • missing comma separators between auth params
  • trailing non-param junk after an otherwise valid challenge

Why

The parser previously used scan, so malformed text between or after matched params could be ignored. For payment challenges, accepting a partially parsed header can hide producer bugs and make interop failures harder to diagnose.

Verification

  • mise exec ruby@3.3 -- bundle exec ruby -Itest test/mpp/test_parsing.rb
  • mise exec ruby@3.3 -- bundle exec rake test
  • mise exec ruby@3.3 -- bundle exec standardrb lib/mpp/parsing.rb test/mpp/test_parsing.rb
  • git diff --check

Signed-off-by: EfeDurmaz16 <efebarandurmaz05@gmail.com>
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.

1 participant