Skip to content
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

Why does waitress ignore http headers with "_" ? #194

Closed
bostrick opened this issue May 20, 2018 · 2 comments
Closed

Why does waitress ignore http headers with "_" ? #194

bostrick opened this issue May 20, 2018 · 2 comments

Comments

@bostrick
Copy link

When parsing headers, waitress ignores any any HTTP header with "_"...

https://github.com/Pylons/waitress/blob/master/waitress/parser.py#L185

This is non-intuitive, and against RFC7230 spec...

https://tools.ietf.org/html/rfc7230#appendix-B

header-field = field-name ":" OWS field-value OWS
field-name = token
token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
"^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA

This led to wasted effort debugging the wrong layer of a protocol before using a packet sniffer... is there a reason for it?

Thanks!

@digitalresistor
Copy link
Member

Yes, there is a reason for it. Security.

Please see #129

As mentioned in https://www.djangoproject.com/weblog/2015/jan/13/security/ which led to #80, and underscore in HTTP headers being stripped being implemented in Waitress:

In order to prevent such attacks, both Nginx and Apache 2.4+ strip all headers containing underscores from incoming requests by default.

@bostrick
Copy link
Author

Thanks for quick response! I'll file against mod_auth_openidc for introducing subtly problematic default headers ;)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants