fix: mitigate slow JSON stream / slow-body attacks - #453
Conversation
Add nginx client_body_timeout (previously unset) and make Apache's existing RequestReadTimeout MinRate settings configurable via env vars, per https://github.com/cr0hn/slowjson#mitigations-quick-reference.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR introduces configurable request timeout environment variables. Apache and Apache-alpine Dockerfiles add four REQUEST_READ_TIMEOUT_* variables consumed by httpd-modsecurity.conf, replacing hardcoded values. Nginx and Nginx-alpine Dockerfiles add CLIENT_BODY_TIMEOUT, consumed by nginx.conf.template. README documents both. ChangesTimeout configuration
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
client_body_timeout(previously unset), configurable via a newCLIENT_BODY_TIMEOUTenv var (default10s)RequestReadTimeoutMinRatesettings configurable via new env vars (REQUEST_READ_TIMEOUT_HEADER,REQUEST_READ_TIMEOUT_HEADER_MIN_RATE,REQUEST_READ_TIMEOUT_BODY,REQUEST_READ_TIMEOUT_BODY_MIN_RATE) instead of hardcoded values, matching this repo's env-var driven configuration conventionReference: https://github.com/cr0hn/slowjson#mitigations-quick-reference
Test plan
client_body_timeoutappears in the rendered nginx configRequestReadTimeoutreflects the configured env vars in the rendered Apache configAI Disclosure
${VAR}substitution mechanism against existing directives in the same config file, verified env var naming/placement against existing conventions in both Dockerfiles, and cross-checked all changed files for internal consistency (grepacross templates, Dockerfiles, and README)Summary by CodeRabbit
New Features
Documentation