-
Notifications
You must be signed in to change notification settings - Fork 9
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
Escape Character %2F in Path Parameter of RestInterface Leads to 404 #34
Comments
Relevant place in the implementation: vibe-http/source/vibe/http/router.d Lines 210 to 215 in 39e7429
In order to allow matching such internal slashes, we'd have to do some deeper changes here, but as long as they are just part of a placeholder, we may get away with replacing slashes in path segments with some Unicode character as a replacement for the matching process. When filling the placeholders later, this would then have to be reverted appropriately. It does have the disadvantage of being ambiguous for the case where a path segment actually already contains this replacement character in the input and we'd have to think well about possible security implications (and in doubt just ignore request that contain them). |
This utility function will be used to url-encode paths added to a URLRouter, which avoids the problem of having to resolve encoding problems when resolving routes. See: vibe-d/vibe-http#34
There are two changes in this MR that work together: * Remove logic to abort routing if a path segment contains a path separator, e.g. '%2F'. * URL path parameters and decoded before being passed to route handlers. * To still permit matching URL routes that are not URL encoded, e.g. '/foo bar', encode these paths before adding them to route matching. See: vibe-d#34
I added two small changes that should make this possible:
|
Issue is resolved with the merging of #35. |
Summary:
It seems as if URL decoding of URL path parameters happens before path segments are separated, leading the URLRouter to be unable to find matching routes if a path parameter value contains a URL encoded
/
character as%2F
.Reproduction Steps:
Consider the following example program:
Called with the
:name
parameter set tobob
works as expected:However, escaping a
/
character as%2F
causes a 404 error. For example, URL encoding the valuebob/ham
results inbob%2Fham
and the following interaction:Expected Result:
For the URL
http://localhost:8090/api/bob%2Fham/age
, the valuebob%2Fham
should have been recognized as being the path parameter:name
, URL decoded, and then given as the function parameter_name
with valuebob/ham
.The text was updated successfully, but these errors were encountered: