-
Notifications
You must be signed in to change notification settings - Fork 45
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
Specify max header and URL in request line lengths #38
Comments
With the new parser, the limits are bound to the buffer size: boost.http/include/boost/http/socket-inl.hpp Line 802 in dc1dfee
But I need to add code to reply with the appropriate status code (URL too long, header field too long...) and I need to update documentation. |
Oh, buffer size limitation works fine in this case. It's just better from user perspective to be able to set these configuration options. |
It adds more security, but I still need to write documentation. And a maximum number of headers would still be desirable. I'll leave the issue open until I update the documentation. |
What do you at first creating class
Then checks probably should be added to
Please notice that reader is returning immediately, because there is no point to continue message parsing: no room for more data. |
RFC7230 suggests a buffer that can process a request-line of 8000 characters, so I think this is a realistic size. However the user only needs to accept requests it is able to process (e.g. if it doesn't have any URL this big, there is no reason to accept such long...).
Boost.Http tries to make a clear separation between two layers. The first is a "message-passing framework" which can be used to request and reply HTTP messages. The second is an embedded server implementation that exposes this layer ( The idea is that you will be able to create a single handler that will respond to HTTP requests coming from multiple backends (embedded HTTP/1.1 server, embedded HTTPS/1.1 server, HTTP/2.0 server, ZeroMQ load-balancing, Apache module...) or change your code to use a different backend without needing to change the handler. Long fields could be rejected (actually discarded) in the Long fields could also be rejected in the backend ( This I'd prefer a |
I started to understand you design :). Just to add a few more points, from administrative point of view. If the library is used on low-memory devices, then long header name / fields and body (probably user also should be able to configure this) should be discarded or message should be rejected as soon as possible and memory to be released. Even this is not limited only to low-memory devices. I can be a bad guy and send 2GB of header name to cloud machine with 1GB memory. These type of attack is pretty common. |
I think that good security enhancement would be some max lengths configurations:
These are possible attack surfaces.
The text was updated successfully, but these errors were encountered: