-
-
Notifications
You must be signed in to change notification settings - Fork 736
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
Timeout to prevent slow sending attack #389
Comments
Yes, it is part of Node.js itself, which is why it is not implemented again in this module: https://nodejs.org/dist/latest-v13.x/docs/api/http.html#http_server_timeout |
That is an inactivity timeout. It does not apply here. |
Ah. Well, I presume the protection needs to be at the Node.js server level regardless, right? Is this something that Node.js is missing? There are many, many body parsing modules on npm, including the ability to make them yourself of course. |
I see Node.js has a headers timeout, at least: https://nodejs.org/dist/latest-v13.x/docs/api/http.html#http_server_headerstimeout |
Yes, my understanding is that it's the body parser's responsibility to implement the timeout (of parsing the body). |
Why would that be part of parsing and not part of the stream reading itself? Is this stated somewhere you can link to for where your understanding comes from? If you're saying this is a feature you think should exist here, you're welcome to make a pull request. But if I'm understanding your request correctly that would be a hurge disservice to the npm ecosystem at large as I presume every single module would need to implement this? |
This is the general docs I refer to when looking for the body reading Node.js docs: https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/#request-body There doesn't seem to be any indication that low level timeouts should be the responsibility of the reader and looking at the two "reference" modules linked there they don't seem to be doing any kind of special timeout behavior? Is it really a feature missing from Node.js? |
I'm going to go with yes. Relevant issues: The attack can easily be re-created: redacted |
I would suggest contacting Node.js following https://nodejs.org/en/security/ is possible. The issue adding it here is that (1) users may not even use this module (2) use a different module (3) use a different framework based on Node.js. It seems strange they have some timeouts and not others. The inactivity timeout for example is on the body, so it's not like there are no body timeouts currently in Node.js. Perhaps this is an overlooked vector. |
This has been fixed in Node.js's latest security release. |
Is there a timeout feature that prevents a malicious client from slowly sending 1 byte at a time to prolong the request?
The text was updated successfully, but these errors were encountered: