Bound the scope3 identity-config response read

Closed Beginner friendly
#562 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #569 by @bokelley — merged

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
backend, security

Research direction

Start in targeting/identityconfig/scope3/source.go: the unbounded json.NewDecoder(resp.Body).Decode(&decoded) is near line 245, and the deferred close with an unbounded io.Copy(io.Discard, resp.Body) is near line 230. Re-check those lines on current main, then compare with the 1 MiB cap at router/router.go:794. Done means both reads are bounded with a local limit, with no dependency on adcp/v3/signing, and existing tests still pass.

Written by the indexing model from the issue text.

Description

Surfaced by the security review of #561 (response-size cap on signed HTTP clients). Same bug class, different module, so it was deliberately left out of that PR.

targeting/identityconfig/scope3/source.go reads a remote config endpoint with no size bound:

  • :245 — json.NewDecoder(resp.Body).Decode(&decoded) with no io.LimitReader, so a hostile or misbehaving config endpoint can drive the process out of memory. This is the same failure mode as #561: a 17.8 MB response OOM-killed the hosted compliance worker.
  • :230 — the deferred close does an unbounded io.Copy(io.Discard, resp.Body). A never-ending body hangs there indefinitely.

Every other agent-facing read in the tree is already capped: router/router.go:794 (1 MiB), tmpclient/client.go:226 (1 MiB), registry/client.go (10 MiB).

Suggested fix: bound the decode with an explicit limit in the same style as the router, and bound (or drop) the drain in the deferred close. targeting has no dependency on adcp/v3/signing, so this wants a local limit rather than reuse of signing.ResponseLimitTransport.

Line numbers are from main at 539631e — re-verify before working on it.

Dominant language
Go
Stars
4
Forks
2
Avg merge
1d 1h
Merged PRs (30d)
26

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from adcontextprotocol/adcp-go

All issues in adcontextprotocol/adcp-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.