Skip to content

percent-encode the username when building probe URLs#3009

Open
HrachShah wants to merge 1 commit into
sherlock-project:masterfrom
HrachShah:fix/url-encode-username-upstream
Open

percent-encode the username when building probe URLs#3009
HrachShah wants to merge 1 commit into
sherlock-project:masterfrom
HrachShah:fix/url-encode-username-upstream

Conversation

@HrachShah

Copy link
Copy Markdown

The only call sites built the per-site URL with
username.replace(' ', '%20') and passed the result into
interpolate_string. That replaced spaces and nothing else: a username
containing ?, #, &, +, /, %, or any non-ASCII byte (e.g.
é, emoji) was spliced into the URL raw, which corrupts the request —
? becomes a query-string delimiter, # a fragment, + a space
once form-decoded, / an extra path segment, and a raw non-ASCII byte
forces the HTTP library to re-encode the path and can land the request
on a different route than intended.

urllib.parse.quote(username, safe='') encodes everything outside the
unreserved set (letters, digits, -._~) and is what the receiving
site is expected to URL-dec

The only call sites built the per-site URL with
`username.replace(' ', '%20')` and passed the result into
`interpolate_string`. That replaced spaces and nothing else: a username
containing `?`, `#`, `&`, `+`, `/`, `%`, or any non-ASCII byte (e.g.
`é`, emoji) was spliced into the URL raw, which corrupts the request —
`?` becomes a query-string delimiter, `#` a fragment, `+` a space
once form-decoded, `/` an extra path segment, and a raw non-ASCII byte
forces the HTTP library to re-encode the path and can land the request
on a different route than intended.

`urllib.parse.quote(username, safe='')` encodes everything outside the
unreserved set (letters, digits, `-._~`) and is what the receiving
site is expected to URL-dec
@HrachShah HrachShah requested a review from ppfeister as a code owner June 18, 2026 09:49
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