Use NSURLComponents to properly encode tokens - #618
Draft
w-goog wants to merge 3 commits into
Draft
Conversation
Base automatically changed from
refactor/consolidate-logging-parameters
to
main
August 7, 2026 23: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
force-pushed
the
refactor/revoke-url-components
branch
from
August 7, 2026 23:09
389ce68 to
a6c6902
Compare
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.
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 "+".