Skip to content

docs(client): note hostile-peer SSE bypass on maxResponseBytes (#1757)#1760

Open
bokelley wants to merge 1 commit into
mainfrom
docs/max-response-bytes-sse-hostile-peer-note
Open

docs(client): note hostile-peer SSE bypass on maxResponseBytes (#1757)#1760
bokelley wants to merge 1 commit into
mainfrom
docs/max-response-bytes-sse-hostile-peer-note

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Summary

Closes #1757.

Appends a hostile-peer caveat to the TransportOptions.maxResponseBytes TSDoc in src/lib/protocols/index.ts. The existing @remarks block already documents the SSE pass-through as a feature (so legitimate long-lived buyer sessions aren't torn down). This adds a second @remarks block immediately after it, naming the corollary: a peer can opt itself out of the cap by responding with Content-Type: text/event-stream.

Why this matters: MCP and A2A both stream tool responses as SSE, and cumulative event-frame bytes are unbounded by spec. The MCP/A2A SDKs consume SSE incrementally and frame termination bounds memory in practice, so this is not a memory-bomb risk for well-formed transports — but adopters relying on maxResponseBytes as a hostile-server defense should treat it as best-effort for non-SSE responses only.

Docs-only. No behavior change. Patch changeset per CLAUDE.md changeset conventions (library TSDoc ships in the published package).

Context:

Test plan

  • npm run format:check clean.
  • npm run typecheck clean.
  • CI green on the patch changeset.

Append a hostile-peer caveat to the `TransportOptions.maxResponseBytes`
TSDoc: a peer can opt out of the cap by responding with
`Content-Type: text/event-stream`. Frame-incremental consumption in the
MCP/A2A SDKs keeps this from being a memory bomb for well-formed
transports, but adopters relying on the cap as a hostile-server defense
should treat it as best-effort for non-SSE responses only.

Follow-up to #1750 (the SSE-bypass fix) and #1176 (origin).
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.

docs: warn that hostile peers can bypass maxResponseBytes by claiming Content-Type: text/event-stream

1 participant