Skip to content

server: a body no route reads is capped at 64 KiB - #3029

Merged
ashhart merged 2 commits into
mainfrom
security/unread-body-cap
Nov 13, 2026
Merged

ashhart merged 2 commits into
mainfrom
security/unread-body-cap

Conversation

@ashhart

@ashhart ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

What this changes

Before: a request that is not a POST had its body read before routing, up to 32 MiB, with no key. After: a body no route reads has a 64 KiB cap of its own, and a larger one gets HTTP 400.

  • Issue: n/a. SECURITY.md asks for private reports, so there is no public issue.
  • Stacked on: main.
  • atc overlap --json: not run.

Checks on this head

  • Head commit: 5be49942f09646bfd81d31804ee9b04180ac03dd
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 345 on the base, 345 on this head, 0 new.
  • Tests run, with the command and pass, fail and skip counts:
    • zig fmt --check on 2 files: passes
    • git diff --check: passes
    • zig build test-server-cpu: 5/5 steps succeeded; 1325/1332 tests passed (7 skipped)
    • zig build check-native-cuda-host compile-flashnext-mtp-parity-host compile-glm-native-open: 11/11 steps succeeded
    • zig build test-golden test-server-security test-pull-security: 76/76 steps succeeded; 23/23 tests passed
  • CI: runs on this push.
  • Not run, and why: No Zig unit test. The two new cases are in zig/tests/server/security_check.py, which runs against the built server. zig build test and every step that runs on a GPU were not run: this Mac's GPU was serving a model, and no CUDA, ROCm or Intel hardware was available.

Receipt

n/a. This change cannot reach inference: it is HTTP body framing for routes that read no body.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. Main with only this branch's tests added, zig build test-server-security: exit 1. FAIL GET body of 65537 bytes against the unread cap: expected [400], got [200].
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

Suggested changelog line

Server: a request body that no route reads is capped at 64 KiB.

Every request that is not a POST had its body read before routing, up to 32 MiB, with no key. Such a
body is read only to keep the connection in step, so it now has a 64 KiB cap of its own.
@ashhart
ashhart force-pushed the security/unread-body-cap branch from 5be4994 to c535a9b Compare November 13, 2026 00:01
@ashhart
ashhart merged commit f8a7f60 into main Nov 13, 2026
2 of 10 checks passed
@ashhart
ashhart deleted the security/unread-body-cap branch November 13, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant