Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Preserve percent-encoding in URLs when performing redirects in the UrlMatcher #25427

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

Closed
wants to merge 2 commits into from

Conversation

mpdude
Copy link
Contributor

@mpdude mpdude commented Dec 10, 2017

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

While investigating #25373, I found that when the dumped UrlMatcher performs redirections due to missing trailing slashes on URLs, it does so using an urldecoded URL.

This is wrong, as it may lead to wrong interpretations of URLs upon the next request. For example, think of an URL that contains %23 in the middle of the path info. Upon redirection, this will be turned into # with an obvious effect.

@nicolas-grekas
Copy link
Member

Can you check the failures please?

@mpdude
Copy link
Contributor Author

mpdude commented Dec 11, 2017

fabbot complains about fixtures (src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher{1,2,3}.php). Won't fix that, as it would also mean having to change the MatcherDumper.

@mpdude
Copy link
Contributor Author

mpdude commented Dec 11, 2017

Overall, would it be better to apply rawurlencode instead of trying to preserve the URL as- is?

@fabpot
Copy link
Member

fabpot commented Dec 14, 2017

Thank you @mpdude.

fabpot added a commit that referenced this pull request Dec 14, 2017
…s in the UrlMatcher (mpdude)

This PR was squashed before being merged into the 2.7 branch (closes #25427).

Discussion
----------

Preserve percent-encoding in URLs when performing redirects in the UrlMatcher

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

While investigating #25373, I found that when the *dumped* `UrlMatcher` performs redirections due to missing trailing slashes on URLs, it does so using an url*de*coded URL.

This is wrong, as it may lead to wrong interpretations of URLs upon the next request. For example, think of an URL that contains `%23` in the middle of the path info. Upon redirection, this will be turned into `#` with an obvious effect.

Commits
-------

8146510 Preserve percent-encoding in URLs when performing redirects in the UrlMatcher
@fabpot fabpot closed this Dec 14, 2017
@fabpot
Copy link
Member

fabpot commented Dec 14, 2017

@mpdude Can you have a look at why the tests are broken on 3.4 (https://travis-ci.org/symfony/symfony/jobs/316592496)? Thanks.

@nicolas-grekas
Copy link
Member

Tests fixed in 3c67741

This was referenced Dec 15, 2017
This was referenced Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.