fix(#510): fix fragment parsing for padded hash values#514
Open
rbalogic wants to merge 2 commits into
Open
Conversation
Author
|
@KevinRoebert could you take a look at this when you have time? This PR is a narrow fix for fragment preservation. It addresses the Claude magic-link breakage by making sure hash payloads containing trailing The change is limited to |
|
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.



Summary
Fix fragment parsing so ClearURLs preserves legal fragment payloads containing
=padding, including cases like#token=and#token==.This addresses the Claude login issue where magic-link URLs were being rewritten in a lossy way, causing the fragment token to break.
Problem
ClearURLs parses fragment content through
URLHashParams, but the current implementation reconstructs fragment values incorrectly when theycontain trailing
=or additional=characters.Examples of broken cases before this change:
#token=became#token#token==became#token#state=abc==became#state=abcThat behavior is not valid for arbitrary URI fragments and can break sites that store opaque state in the hash.
Changes
==verbatim""andnullare handled distinctlyResult
The following fragments now round-trip correctly:
#token=#token==#state=abc==#foo=bar=baz#plainScope
This PR is intentionally limited to the fragment-preservation bugfix.
The broader “disable on this site/domain” functionality will be handled separately as a feature PR.
Related Issues