Prevent unbounded request body reads#759
Conversation
|
I would set the default to 0 (unlimited) so that we don't introduce a breaking change. A future major release could change the default to be non-zero. |
|
I evaluated that as an option while creating the patch, but I think it's better to force a new release with the limitation by default. Let's see if @adnanh review the patch and decides what's best. I don't mind to change if that allows this PR to be accepted. |
|
First, thanks for the contribution! I agree with @moorereason, I've always tried hard to keep the default behavior consistent, even if it's not a good practice. The flag will be there, people can use it, we can recommend using it and maybe introduce a "this behavior will change in the future" warning, but it shouldn't definitely silently break after next release :-) |
Add a -max-body-size flag to optionally limit request body reads and return 413 for oversized requests. Keep the default at 0 to preserve existing unlimited behavior, but warn on startup when request body size is unlimited and document the production recommendation to configure a positive limit. Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
|
Restored the unlimited default and added a warning at startup when |
Add a
-max-body-sizeflag with a 32 MiB default and allow 0 to preserve unlimited behavior. Return 413 for oversized requests and cover both rejection and normal request paths with tests.Fixes #756