Report malformed percent-escapes in Google resource URLs - #272
Closed
snowyukitty wants to merge 1 commit into
Closed
Report malformed percent-escapes in Google resource URLs#272snowyukitty wants to merge 1 commit into
snowyukitty wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Closing this myself: CONTRIBUTING asks contributors to keep PRs to "a dozen or so lines" and this one is +16/-4, which is over that line. #221 was the right size and I should have kept to it here. Leaving the report behind in case it is useful: in I am not reopening this as a smaller PR. Splitting a change to fit the size guideline would be evading it. |
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.
What does this change?
Binding a Google resource from a URL containing a bare
%throws an unhandledURIError: URI malformedinstead of the explanatory errors every sibling validation path ingetGatekeeperClassFor()raises.https://mail.google.com/mail/u/0/#search/50%offis the reproduction reported in #55.This adds a
decodeResourceUrlPart()helper —decodeURIComponent()in atry, rethrowing asInvalid <part>: it cannot be percent-decoded. Encode a literal "%" as "%25".— and uses it at the four bare decode sites ingetGatekeeperClassFor(): the Gmail#search/query, the Gmail#label/name, the Google Calendar path segment, and the BigQuery path segments.#55 notes the same bare-decode pattern in other gatekeeper packages; this PR deliberately stays on the reported backend path to remain a small, single-concern change.
Fixes #55
Why is this obviously correct and trivially verifiable?
The success path returns exactly what
decodeURIComponent()returned, unchanged. The only behavioral difference is that a thrownURIErrorbecomes anErrorwhose message follows the wording style of the sibling validation messages in the same function. There are no control-flow, dependency, or API changes.Verified on Windows 11 (Node 22.22.3, pnpm 11.17.0) against
4288713:tsc -p packages/gatekeeper-googleand fullpnpm lintpass.AI tools authored this patch under human direction, and an independent AI review approved it before submission; the verification commands above were run locally.
Checklist
Checking every item does not guarantee acceptance. Maintainers determine whether
a pull request meets the contribution policy.
🤖 Generated with Claude Code