fix(server): cap /mcp body size (SRV-03)
The /mcp nest (to_mcp streamable HTTP service) collects the raw body itself, so axum's extractor-based DefaultBodyLimit never applies and a multi-GB chunked POST buffers entirely in memory (review-001 SRV-03). Wrap the nest with an explicit counting-body middleware: 8 MiB cap (headroom over the gateway's 2 MiB for JSON-RPC batch payloads), Content-Length-declared oversizes rejected before reading, streaming oversizes cut off mid-read and answered 413 (rmcp maps body-read errors to 500, so the middleware sources the status itself). Verification: cargo check (default + mcp + all-features); mcp test suite pending tree unstuck from parallel agent's WIP.
This commit is contained in:
@@ -43,6 +43,7 @@ uuid = { version = "1", features = ["v4"] }
|
||||
futures = "0.3"
|
||||
openapiv3 = "2"
|
||||
http = "1"
|
||||
http-body-util = "0.1"
|
||||
url = "2"
|
||||
bytes = "1"
|
||||
jsonschema = { version = "0.46", default-features = false }
|
||||
|
||||
Reference in New Issue
Block a user