Skip to content

MAX_REQUEST_BYTES: spec says 10MB, both implementations enforce 1MB #573

Description

@Yatsuiii

docs/spec/proxy-security.md:39 specs MAX_REQUEST_BYTES = 10 * 1024 * 1024 # 10MB.

Both implementations enforce 1MB:

  • scripts/mock_upstream.py, MAX_REQUEST_BYTES = 1_000_000
  • src/cmcp_runtime/mcp/server.py, _DEFAULT_MAX_REQUEST_BYTES = 1_000_000, used as the max_request_bytes default on MCPServer.__init__

An order of magnitude apart, and nothing in the repo records which one is intended. I raised this on #562 while implementing MAX_STRING_LENGTH and deliberately didn't pick a side, but #562 was closed as completed by #570, so the question isn't tracked anywhere now. Opening this so it isn't lost.

The two readings lead opposite ways:

  • 1MB was a deliberate tightening, and the spec is stale. Fix the document.
  • 1MB is drift, and implementations should be raised toward 10MB. Fix the code, and note that widening a DoS bound is not a change to make quietly.

I don't have evidence for either. The spec is Draft v0.1 and its git history doesn't say where 10MB came from.

Two things that depend on the answer, so it's worth settling rather than leaving:

MAX_STRING_LENGTH is now derived from whatever body cap is enforced (#570, and #572 makes the spec say so), which removes the dead-code hazard at either value. So this doesn't block that. But the derived cap moves with the body cap, and a jump from 1MB to 10MB moves the per-string cap from 500KB to 5MB, which is a real change in what the gateway accepts rather than a documentation cleanup.

MAX_JSON_NESTING_DEPTH and MAX_PARSE_TIME_MS are still unimplemented. Whoever implements them will size them against a body cap, and picking against the wrong one bakes the mismatch in further.

Happy to send whichever patch the answer implies. I don't think it's a contributor's call to make.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions