Repository navigation
Description
Context
Surfaced during PR #3726 security review (must-fix). After investigation, the gap is repo-wide, not specific to measurement vendors:
The AAO discovery crawler calls into @adcp/sdk for tools/list (existing) and get_adcp_capabilities (added in #3726). Neither path enforces a response-body byte cap — node_modules/@modelcontextprotocol/sdk streamableHttp and sse clients buffer the full reply before parsing. A hostile measurement vendor (or any other agent type — sales, creative, signals) publishing a 200 MB JSON-RPC reply will OOM the discovery worker before the parsed-JSON 256 KB check at capabilities.ts:243 runs.
The 10s timeout at capabilities.ts:517 does not mitigate: 200 MB at datacenter speeds arrives in well under 10s.
What this issue tracks
Add a streaming response-body byte cap (proposed: 1 MB for capability docs) at the SDK fetch layer or wrap the crawler invocations with a custom fetch that enforces it.
Two implementation paths:
- SDK-level: add a
maxResponseBytesoption to@adcp/sdk's transport configuration and plumb it through the MCP/A2A clients. - Wrapper-level: wrap the
tools/listandgetAdcpCapabilitiescrawler calls with a fetch implementation that streams + counts bytes, aborting at the cap. Bypasses the SDK abstraction but ships in this repo.
Why deferred from #3726
The vulnerability is pre-existing — tools/list has the same surface against any registered/discovered agent today. Fixing it specifically for measurement is a band-aid that misrepresents the attack surface. Proper fix belongs in a focused hardening PR.
Existing safeFetch precedent
server/src/utils/url-security.ts and node_modules/@adcp/sdk/dist/lib/.../ssrf-fetch.js already implement size caps for other crawler paths (brand.json, adagents.json, raw response capture, network consistency checks). Mirror that pattern.
References
- PR feat(registry): measurement-vendor discovery on /api/registry/agents (#3613) #3726 security re-review
server/src/capabilities.ts:65-130(existingdiscoverToolsflow)server/src/capabilities.ts:496-528(newfetchMeasurementCapabilitiesflow)node_modules/@adcp/sdk/dist/lib/protocols/{mcp,a2a}.js(no body cap today)
Activity
bokelley commentedon May 1, 2026
Triage
Classification: Bug
Bucket(s): security-sensitive (no
security-sensitivelabel exists in this repo — noted below)Status: ready-for-human
What the experts said:
cappedFetch) reliably intercepts before SDK buffering onstreamableHttp— theAdCPClientconstructor accepts afetchoverride that fires before the MCP SDK's internalReadableStreamreader. SSE slow-drip is a complication (counter accumulates per-session, not per-message) but not a blocker for the crawler's request/response pattern. Ship Path A now; SDK-levelmaxResponseBytes(Path B) is the right long-term fix before self-service registration opens. 1 MB cap is too tight fortools/list(legitimate large agents can reach ~2 MB with 500 tools); safer split: 4 MB fortools/list/discoverTools, 1 MB forget_adcp_capabilities.ReadableStreampassthrough that aborts mid-stream (matchesreadBinaryWithSizeLimitaturl-tools.ts:57–95) rather than buffer-and-reconstruct — unboundedPromise.allindiscoverAll:537means N × cap in concurrent memory under Path A. Extract a sharedcappedFetch(maxBytes)helper inurl-security.ts. Keep the 256 KB post-parse check atcapabilities.ts:249as independent defense-in-depth; it guards a different invariant (oversized-but-valid serialized payload) and should not be lowered to match the wire cap.My take: Both experts converge — wrapper-level PR now for the crawler call sites, SDK
maxResponseBytestracked as a follow-on. The unresolved questions are scope (3 crawler sites vs all 7AdCPClientcallers in this repo) and whether to split the cap by call type.@bokelley, your call on three points before the PR opens:
Option A — Crawler scope only (3 call sites in
capabilities.ts):health.ts,formats.ts,properties.ts,mcp-tools.tsstay uncapped until Path B lands.Option B — Wider scope (all 7
AdCPClientcall sites in this repo):Closes the same gap in health-check and tool-call paths without waiting for the SDK; larger diff but no additional design risk.
The three decisions:
@adcp/sdkmaxResponseBytesfollow-on in the SDK repo? (This routine can't open cross-repo issues.)Triaged by Claude Code. Session: https://claude.ai/code/cse_01XjUzCwaRsKGTKK4xCeByH3
Generated by Claude Code
bokelley commentedon May 13, 2026
/triage execute
Ship Path A (wrapper-level
cappedFetch) per security-reviewer's recommendation. Keep Path B (SDKmaxResponseBytes) as a separate follow-up issue — don't conflate.Implementation requirements:
readBinaryWithSizeLimitaturl-tools.ts:57-95) — do not buffer-and-reconstruct. The unboundedPromise.allindiscoverAll:537means buffer-then-cap would still allow N × cap concurrent memory.cappedFetch(maxBytes)helper rather than inlining at each call site.tools/list/discoverTools(legitimate large agents reach ~2 MB with 500 tools)get_adcp_capabilitiesfetchoverride on theAdCPClientconstructor — it fires before the MCP SDK's internalReadableStreamreader (confirmed by security-reviewer).streamableHttp.maxResponseBytes) before self-service registration opens.Default-deny on scope creep.
fix(security): cap response body size on AAO discovery fetches (#3731)
bokelley commentedon May 16, 2026
Triage correction (manual backfill — routine was failing with HTTP 429)
The prior triage analysis was stale on one key fact:
@adcp/sdkalready supportstransport.maxResponseByteswith the exact mid-stream-abort pattern Path A wanted (withResponseSizeLimit/wrapFetchWithSizeLimit). The proposedcappedFetchwrapper andfetchoverride on theAdCPClientconstructor don't apply —SingleAgentClientConfighas nofetch/fetchImplfield.Shipped: PR on branch
bokelley/triage-unassigned-issues(commit5cf37ed5cc) passestransport.maxResponseByteson the threeAdCPClientconstructors inserver/src/capabilities.ts:discoverMCPTools/discoverA2AToolsfetchMeasurementCapabilitiesResidual gap (upstream):
getAgentInfo()/mcpClient.listTools()in the SDK don't currently route throughwithResponseSizeLimit, so the 4 MB cap is dormant on thetools/listbody.get_adcp_capabilitiesis covered today. Filed upstream: adcontextprotocol/adcp-client#1799.chore: address expert feedback on triage backfill PR
chore: address expert feedback on triage backfill PR
fix(security): cap response body size on AAO discovery fetches (adcon…