-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Hapi not rejecting non-URL-encoded data on route that allows 'application/x-www-form-urlencoded' content type #3422
Comments
We use node's |
@hueniverse Every piece of software that takes input contains a de facto recognizer for accepting valid input and rejecting invalid input. Parser differentials – when two programs parse things differently, one accepting data and another rejecting it – silently invalidate assumptions programmers have about data safety and can lead to security issues. I think a good example of what this can result in is the Android master key vulnerability. For more information why accepting invalid input is a bad idea, read The Seven Turrets of Babel and other LANGSEC papers. |
@hueniverse please reopen. |
Some relevant info on querystring:
So in theory you can make your own querystring.unescape implementation which will not fallback to a safer decode. https://github.com/nodejs/node/blob/master/lib/querystring.js#L90 But I don't know if this you give the 400 error you are expecting or a 500 o even more nasty error... |
@nmoskopp I don't make decision based on general concepts. If you want to make the case we should write our own query string parser, you would need to be a lot more specific. The reasons I closed this issue are:
If you really need a spec compliant parser you can solve this issue by writing your own. I am happy to add a note to the documentation to state that the node parser is very flexible in its interpretation. And last, if you feel strongly about this, I would suggest opening an issue directly with node core. After all, it's their issue. |
I am trying the following test and I am sending non-urlencoded data to a route that 'allows' url encoded data. Since content type of this request is set to 'application/x-www-form-urlencoded', it should encode the payload but it does not.
and the following routes config:
This results in 200 status code instead of 400, since routes should not let users post not encoded characters by default.
Context
The text was updated successfully, but these errors were encountered: