copilot-swe-agent[bot]
ca27a0b687
feat(security): add request size limits to API endpoints
...
- Add RequestSizeLimitMiddleware that checks Content-Length header
before request body is read: non-multipart requests capped at
MAX_REQUEST_BODY_SIZE (default 1 MB), multipart uploads capped at
MAX_UPLOAD_SIZE (default 1 GB). Returns HTTP 413 on violation.
- Register middleware in app/main.py
- Add max_request_body_size setting to app/config.py
- Fix ui_upload in files.py to check Content-Length early and read
in 64 KB chunks (bounded memory usage), removing the post-write
os.path.getsize check
- Document MAX_REQUEST_BODY_SIZE in .env.demo and ConfigurationGuide.md
- Mark SECURITY_AUDIT.md item #4 as resolved
- Add 9 tests in test_request_size_limit.py
- Update test_upload_file_too_large to use patch.object instead of
the now-unused os.path.getsize mock
Closes #173
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com >
2026-02-22 14:41:04 +00:00
..
2025-03-26 16:27:36 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:12:11 +00:00
2026-02-13 09:12:11 +00:00
2026-02-10 15:53:11 +00:00
2026-02-14 00:05:57 +00:00
2026-02-13 09:10:52 +00:00
2026-02-12 03:21:41 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 23:23:35 +00:00
2026-02-12 03:21:41 +00:00
2026-02-17 11:40:34 +00:00
2026-02-13 09:10:52 +00:00
2026-02-14 00:17:16 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-16 15:35:45 +00:00
2026-02-14 00:16:21 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 21:01:04 +00:00
2026-02-12 03:21:41 +00:00
2026-02-08 08:16:54 +00:00
2026-02-22 14:24:27 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-15 10:24:48 +00:00
2026-02-13 09:10:52 +00:00
2026-02-14 00:16:21 +00:00
2026-02-13 09:10:52 +00:00
2026-02-12 03:21:41 +00:00
2026-02-13 16:12:39 +00:00
2026-02-16 15:45:28 +00:00
2026-02-14 00:12:30 +00:00
2026-02-13 09:10:52 +00:00
2026-02-16 15:37:22 +00:00
2026-02-21 09:40:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 22:39:34 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 22:39:34 +00:00
2026-02-14 00:30:52 +00:00
2026-02-16 15:34:36 +00:00
2026-02-13 16:12:39 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-14 00:16:21 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 16:51:07 +00:00
2026-02-14 00:06:55 +00:00
2026-02-12 03:21:41 +00:00
2026-02-13 22:39:34 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-12 03:21:41 +00:00
2026-02-15 10:24:48 +00:00
2026-02-16 15:54:13 +00:00
2026-02-22 14:41:04 +00:00
2026-02-15 10:28:44 +00:00
2026-02-13 23:40:31 +00:00
2026-02-12 03:21:41 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-14 00:34:34 +00:00
2026-02-14 00:05:57 +00:00
2026-02-14 00:16:21 +00:00
2026-02-12 17:32:17 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-16 15:56:19 +00:00
2026-02-09 20:56:35 +00:00
2026-02-12 03:21:41 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 23:56:57 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-09 15:14:40 +00:00
2026-02-22 14:41:04 +00:00
2026-02-13 22:39:34 +00:00
2026-02-13 16:51:07 +00:00
2026-02-16 20:40:44 +00:00
2026-02-12 03:21:41 +00:00
2026-02-16 15:47:20 +00:00
2026-02-13 09:10:52 +00:00
2026-02-12 03:21:41 +00:00
2026-02-12 03:21:41 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-14 00:16:21 +00:00
2026-02-13 16:51:07 +00:00
2026-02-13 23:33:25 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 23:45:11 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-17 04:35:00 +00:00
2026-02-17 11:40:34 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 16:51:07 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 23:36:32 +00:00
2026-02-09 20:55:53 +00:00
2026-02-13 09:10:52 +00:00
2026-02-12 03:21:41 +00:00
2026-02-13 09:10:52 +00:00
2026-02-13 09:10:52 +00:00
2026-02-14 00:16:21 +00:00
2026-02-17 12:01:40 +00:00
2026-02-12 03:21:41 +00:00
2026-02-13 11:48:36 +00:00
2026-02-15 10:24:48 +00:00
2026-02-13 23:46:57 +00:00