Skip to content

Use NSURLComponents to properly encode tokens - #618

Draft
w-goog wants to merge 3 commits into
mainfrom
refactor/revoke-url-components
Draft

Use NSURLComponents to properly encode tokens#618
w-goog wants to merge 3 commits into
mainfrom
refactor/revoke-url-components

Conversation

@w-goog

@w-goog w-goog commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The two URLs here interpolated tokens into the query strings, and then called urlWithString:. An &, #, =, or plausibly + in a token would break the URL. RFC 6750 & RFC 6749 define the bearer & access tokens such that "=" and "+" are allowed (and the access token allows even more characters).

This PR addresses the non-"+" characters, as Foundation inexplicably doesn't escape "+".

Base automatically changed from refactor/consolidate-logging-parameters to main August 7, 2026 23:09
w-goog added 3 commits August 7, 2026 16:09
Assemble the token revocation URL from components and query items rather
than by string formatting, so the token and the logging parameters are
percent-encoded rather than interpolated raw into a URL string.
Assemble the user info URL from components and query items so the access
token is percent-encoded rather than interpolated raw into a URL string,
matching the revoke URL construction.
Revoke a token containing "&", "=" and "#" and assert it round-trips
through the revoke URL intact, along with the logging parameters. Against
the previous string-formatted URL this fails: the token is truncated at
the "&" and both logging parameters are lost to the fragment.
@w-goog
w-goog force-pushed the refactor/revoke-url-components branch from 389ce68 to a6c6902 Compare August 7, 2026 23:09
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