-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Uri
shouldn't accept curly braces ({
, }
) in path parts
#3594
Comments
Seems like the curly braces were made valid after hyperium/http#474 with the comment on why it was accepted. I agree that most usage doesn't accept curly braces as valid characters. A good alternative would be to split this into two entities: a |
JSON embedded in the URI path seems like a crime. |
If it is not spec-compliant according to @SergioBenitez comment, why accept them? |
It does seem wrong, but it is also seen in real life by servers. Real life unfortunately tends to differ from specs. Engineering is often trying to find the right balance of which to stick to. |
Are there any more details on exactly which servers or clients we're concerned with? The motivation for the initial change feels unsubstantiated to me. I regard it as peculiar to make a change that impacts an entire ecosystem for the concerns of a single (?) party without substantial motivation or explanation, especially when that change may have security implications. |
For some testing, I sent a request with braces to several servers (h2o.examp1e.net, github.com, google.com, even httpbin.org/anything/{anything}), and they all either returned either a 404 or a 200.
I saw the mention of security concerns in the linked issue, but I would never recommend anyone pass untrusted data to a templating engine without escaping it. It seems unfair to send a message to users implying hyper is insecure because of this. |
The README for
There's even emphasis on "correct'. The docs for
And specifically, the parsing
Composed together, this says that If hyper is going to deviate from specs that it claims to follow, then it should make this very clear and not allude to specifications without clarifying how it deviates. |
I think it's fine if any particular server wants to accept technically invalid URIs. My concern is largely that if one uses hyper to implement a server, then the choice to accept or not accept technically invalid URIs is largely absent, and worse, they may believe that any URI accepted by hyper is a valid one, given the documentation. In similar domains, such as HTML parsing, libraries leave this choice to the user for a variety of reasons. |
@SergioBenitez constructed a solid argument imo. |
Please see rwf2/Rocket#2733 for a run-down of the concerns. Note that none of Firefox, Chrome, nor Safari believe such a URI is valid, so this does not appear to be an exception made in practice. It is also not spec-conformant.
The text was updated successfully, but these errors were encountered: