security: add request body size limit to prevent DoS

Add MaxRequestSize configuration to HTTPConfig with a default of 1MB.
Use http.MaxBytesReader to enforce the limit, returning 413 Request
Entity Too Large when exceeded.

This prevents memory exhaustion attacks where an attacker sends
arbitrarily large request bodies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 22:04:11 +01:00
parent cbe55d6456
commit 149832e4e5
3 changed files with 71 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
result
*.db