Skip to content

Conversation

@TheodorNEngoy
Copy link

@TheodorNEngoy TheodorNEngoy commented Feb 7, 2026

This adds a basic DoS guard for the built-in HTTP transports by limiting POST request body size.

  • Adds MaxBodyBytes to SSEOptions and StreamableHTTPOptions (default: DefaultMaxBodyBytes = 1_000_000; negative disables).
  • Adds MaxBodyBytes to SSEServerTransport and StreamableServerTransport for custom handler usage.
  • Returns 413 Request Entity Too Large when the limit is exceeded.
  • Includes tests covering both SSE and streamable handlers/transports.

Rationale: avoid unbounded io.ReadAll(req.Body) buffering for network-exposed servers.

@TheodorNEngoy
Copy link
Author

Local sanity check: go test ./... passes on this branch.

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