Fix subscriber requests that address the wrong member via the URL - #66
Open
pcbeingused333 wants to merge 2 commits into
Open
pcbeingused333 wants to merge 2 commits into
pcbeingused333 wants to merge 2 commits into
Conversation
… requests
These three build a request URL by interpolating the raw email into a
path segment or query string:
request(:delete, "#{ENDPOINT_URL}/#{email}")
request(:get, ".../subscriptions?email=#{email}")
A `+tag` address (`user+news@gmail.com`, very common) is then mangled:
`+` means a space in a query string and is ambiguous in a path, so the
call addresses the wrong subscriber or 404s. `Subscriber::Brevo` already
runs the identifier through `URI.encode_www_form_component`; the other
three now do the same.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GtYgwYNfJ3wHrw9xrooVoB
… email
Mailchimp's List Members API keys a member by the MD5 hash of the
lowercased email address, so `DELETE .../members/#{email}` never matches
and always 404s. Hash the address before building the path.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GtYgwYNfJ3wHrw9xrooVoB
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.
Four subscriber providers build a request URL from the raw email and end up addressing the wrong member.
Buttondown,Mailerlite,Beehiiv— not URL-encodedA Gmail-style
+tagaddress is mangled —+decodes to a space in a query string and is ambiguous in a path:Subscriber::Brevo#destroyalready guards this withURI.encode_www_form_component; these three now do the same.Mailchimp— wrong identifier entirelyMailchimp's List Members API keys a member by the MD5 hash of the lowercased email, so
DELETE .../members/#{email}never matches and always 404s. It now hashes the address before building the path.Tests
New
test/courrier/subscriber/url_encoding_test.rb: a+tagaddress reaches Buttondown / Mailerlite / Beehiiv URLs assubscriber%2Btag%40example.com, and Mailchimp addressesSubscriber@Example.combyDigest::MD5.hexdigest("subscriber@example.com"). All four fail onmain.bundle exec rakeandbundle exec standardrbare green (163 runs, 0 failures).🤖 Generated with Claude Code