Files
reverse-engineering-anything/src/providers
morluto 184e371e04 fix(ida): bound each MCP HTTP reply message like stdio frames (#15436)
* fix(ida): bound each MCP HTTP reply message like stdio frames

IDA over stdio refuses a reply message above 64 MiB with max_response_bytes,
but IDA over HTTP read a successful JSON reply whole with readText() and
JSON.parse, and an SSE stream without any limit. JEB and the agentenv driver
share the same HTTP response validator and were equally unbounded.

validateMcpHttpResponse, which already owns the accepted reply bytes for
UTF-8 validation, now also counts each message (the whole JSON body, or each
SSE event) and refuses one over the consumer's limit before the SDK buffers
or parses it, closing the transport as it does for malformed UTF-8. IDA uses
one message limit for stdio and HTTP and reports the HTTP refusal exactly as
the stdio one: a non-retryable transport resource constraint attributed to
the operation with max_response_bytes. JEB and agentenv use the same 64 MiB
default.

Refs #15326

* fix(ida): count SSE events across CR, LF and CRLF line endings

The per-event counter only recognized LF, so a valid CR-only SSE stream was
counted as one message and could be refused although every event fit.

* fix(ida): count a CRLF event separator with its event and register the HTTP message ceiling

A blank line ended by CR reset the event count before its LF, so that LF
was charged to the next event and an event exactly at the limit was
refused. The reset now waits for the possible LF.

The message allowance is declared through fixedAllowanceOptions so the
fixed-ceiling guard sees it, and is registered as a protocol ceiling.
2026-12-01 10:05:13 -05:00
..