-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(router) properly escape uri captures #8139
Closed
Closed
Conversation
This file contains 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
### Summary When we added normalization `kong.tools.uri.normalize`, that function does percent-decoding on everything, except for the reserved characters. That means that we basically percent-decode more than just the ranges of ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E). Which is fine for matching (as we run both inputs through it). Though calling it `normalize` is wrong, but that is another issue. Because of doing excessive percent-decoding, we endup things leaking from there. One of the leakeage is uri captures that now contain the captures based on our raw normalization. This commit adds escaping to uri captures, and should fix the leak.
This was referenced Dec 2, 2021
I personally like #8140 better. |
bungle
added a commit
that referenced
this pull request
Dec 2, 2021
### Summary This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
bungle
added a commit
that referenced
this pull request
Dec 7, 2021
### Summary This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
bungle
added a commit
that referenced
this pull request
Dec 20, 2021
### Summary This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
bungle
added a commit
that referenced
this pull request
Jan 3, 2022
### Summary This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
bungle
added a commit
that referenced
this pull request
Jan 18, 2022
### Summary This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
dndx
pushed a commit
that referenced
this pull request
Jan 24, 2022
### Summary This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
bungle
added a commit
that referenced
this pull request
Feb 1, 2022
### Summary This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
bungle
added a commit
that referenced
this pull request
May 9, 2022
### Summary This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
StarlightIbuki
pushed a commit
that referenced
this pull request
Jun 27, 2022
This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
StarlightIbuki
pushed a commit
that referenced
this pull request
Jul 14, 2022
This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
StarlightIbuki
pushed a commit
that referenced
this pull request
Jul 18, 2022
This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
StarlightIbuki
pushed a commit
that referenced
this pull request
Jul 22, 2022
This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization.
fffonion
pushed a commit
that referenced
this pull request
Jul 26, 2022
We decide to let `normalize` function to decode URL-encoded string as much as possible. **PLEASE REFERER TO**: #8140 (comment) ### Issues resolved Fix #7913, FTI-2904 Outdated discussion: ---------------------- This is alternative to PR #8139 where we actually fix the normalization function to not do excessive percent-decoding on normalization. When we added normalization kong.tools.uri.normalize, that function does percent-decoding on everything, except for the reserved characters. That means that we basically percent-decode more than just the ranges of ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E). (so called Unreserved Characters) Alternative Implementation: See #8139
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
When we added normalization
kong.tools.uri.normalize
, that function does percent-decoding on everything, except for the reserved characters.That means that we basically percent-decode more than just the ranges of ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E).
Which is fine for matching (as we run both inputs through it). Though calling it
normalize
is wrong, but that is another issue.Because of doing excessive percent-decoding, we endup things leaking from there. One of the leakeage is uri captures that now contain the captures based on our raw normalization.
This commit adds escaping to uri captures, and should fix the leak.
Alternative to this is to not percent-decode the chars outside the ones specified above.
Issues resolved
Fix #7913, FTI-2904
Alternative and Better Implementation
See #8140