-
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
Move HTTP response header validation to node #3065
Comments
For reference: since 4.3.0 node's http module checks for invalid headers characters (itroduced in this commit) and it allows characters in the range of: |
This commit was originally introduced to prevent HTTP Response splitting in hapi apps on node 0.12 and 4 before 4.3. node originally did some bit shifting that turned out to cause a problem in this regard. I haven't investigated to see if that particular problem has been fixed, but I can see if this likely can be cleaned up by grabbing the same range that 4.3.0 allows. |
Is there a work-around at all for this? I'm running into it on hapi 13.4.0 and node 6.2.0. |
@hueniverse would you support changing the header key/value character range to match what node does? There are 2 issues when our validation differs to what happens in
server.route({
method: 'GET',
path: '/',
handler: function (request, reply) {
return reply().header('[header]', 'value');
}
}); hapi won't throw on the above, but it will throw once it gets to node:
|
If #3178 is merged, this can be handled by simply removing the check from hapi, trusting node to throw on these headers. Given that all supported versions of node already make this check, this should be fine, right? Or do we support all v4.x implementations? |
I Rather leave this up to node. If the security issue is not longer there, we can remove it from hapi. |
The strict validation wasn't added to node until 4.3.0. @kanongil not sure about your question regarding which 4.x.x versions we support (I just assumed all). @jefflembeck are you able to confirm if the underlying security issue that prompted you to add the check has been fixed in node core >= 4.0.0? |
We only support latest 4.x and 6.x. We can reflect that in the package.json file |
I recently got a
Header value cannot contain or convert into non-ascii characters: content-disposition
error after sending an attachment response for a file namedcafé.pdf
.The error is thrown in here because the ASCII code of
é
is233
and only codes smaller than127
are allowed.This is not coherent with the content-disposition module which allows up to code
255
.I opened the issue here. If you feel hapi is doing the correct thing, I'll open it with content-disposition.
This check was added in this commit. @jefflembeck since it's your commit, could you please have a look?
The text was updated successfully, but these errors were encountered: