-
Notifications
You must be signed in to change notification settings - Fork 146
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
URL path shortening for ../ creates problem with other URL parsers that do not follow the whatwg standard #810
Comments
Using different parsers is a known security vulnerability and it's one of the reasons we have standardized how URLs are parsed, so more tooling can interoperate with it. I hope you're not expecting that we change the standard over this as that would undoubtedly break the web. |
Are there any plans to also adapt server side parsing of the url in nodejs / the http server module to use the whatwg URL class?
Well actually I would question why it's defined in the standard like this, why not leave the path as it is? BR |
Best to ask Node.js. It's defined in the standard like this because this is how browsers have behaved for a long time. They parse and mostly-canonicalize at the same time. |
Hi
Well then why even follow the whatwg standard if it's mainly focused on browsers? Btw I also opened an issue at fastify. |
Because having different parsers causes issues, I thought we already established that... |
By the way, the treatment of When describing URL normalization, RFC-3986 is explicit about what
It's been a while since I read the HTTP spec, but if I recall correctly, I believe the idea is that the server takes the path and query (together known as the "request target"), and the host (supplied via the Furthermore, I think RFC-3986 is clear that So IMO, that part of the standard, and its embodiment in JavaScript's |
What is the issue with the URL Standard?
Hi,
I would like to share with you a common scenario:
This scenario can lead to path traversal vulnerabilities as Express and Fastify do not evaluate
../
and./
but the whatwg URL does. So the route checks of express / fastify match another path. This situation is not good at all, because the developer need to know about the different parsing / evaluation logic.Example
I have prepared a sample application with fastify.
https://github.com/stefanbeigel/whatwg-fastify-path-traversal/blob/main/index.mjs
Call the app with curl --path-as-is localhost:3000/abc/../foobar
Possible solutions
As this behavior was introduced by the URL class I created this issue, even you can argue that this is a problem of fastify / express / nodejs.
The text was updated successfully, but these errors were encountered: