Skip to content
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

Route parameters are double urldecoded #14367

Closed
RyanDwyer opened this issue Jul 19, 2016 · 0 comments
Closed

Route parameters are double urldecoded #14367

RyanDwyer opened this issue Jul 19, 2016 · 0 comments

Comments

@RyanDwyer
Copy link

In a fresh Laravel installation, I've added this to my routes file:

Route::get('/test/{name}', function($name) {
    echo $name;
});

http://localhost/test/a%20b - outputs "a b" as expected
http://localhost/test/a%2520b - outputs "a b" - expected "a%20b"
http://localhost/test/a%252520b - outputs "a%20b" - expected "a%2520b"

In the second example, the first decode makes it "a%20b" and the second decode turns it into "a b". This makes it impossible to reliably determine what the original input was.

To give a bit of context, we pass S3 filenames as route parameters. These filenames are defined by end users. One particular file is named with a literal %20 in it, so our route parameter contains %2520. In the controller, the double urldecoding makes it a literal space which causes the request to S3 to come back with a 404.

composer.lock shows laravel/framework is at v5.2.39. Sorry I can't investigate further and provide a pull request - I found this as part of my day job so I can't let myself get distracted with fixing framework bugs...

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

No branches or pull requests

1 participant