Skip to content

mcpx(openapi): spec fetch truncates silently at 32MiB instead of refusing past the cap (#4375 contract decision 2) #8271

Closed

Description

@dezren39

Problem

Found by the #4376 closing audit of the #4375 response-read contract (2026-11-10, lane code-b, task 13050). Two buffered reads of a fetched OpenAPI document in pkgs/mcpx/internal/openapi/openapi.go (lines 157 and 690) cap the read with io.ReadAll(io.LimitReader(resp.Body, 32<<20)) — bounded, but silently truncating: contract decision 2 (#4375) requires a buffered success body to be refused past its named cap, never silently truncated (the cap+1-and-refuse pattern the provider paths use with ProviderResponseBodyLimit). A truncated spec parses as a shorter document or fails downstream with a misleading error, instead of failing the fetch at the cap.

The source is an operator-configured URL, so this is a peer read under the contract, not a local file path (the os.ReadFile branch beside line 157 is out of scope — not peer bytes).

Fix shape

Apply the cap+1 refuse pattern at both sites with the cap named in internal/defaults (or recorded as a defaults constant), so an over-cap spec fails the fetch with a clear "exceeds N bytes" error. Behaviour change is deliberately not inside the #4376 audit (its acceptance allows only the single-site embeddings slip fix); this issue is the named follow-up the audit files.

Related: #4375 (contract), #4376 (audit).

Activity

  1. added
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    on Nov 10, 2026
  2. developing-today commented on Nov 10, 2026

    @developing-today
    Contributor
  3. added a commit that references this issue on Nov 17, 2026
  4. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: done
    task: 18622
    lane: any-m
    worker: repo-worker-code

    Task 18622 (triage of issue #8271) — fixed and merged in the same claim (inline triage, section 1c):

    • Verified fresh: both silent-truncation sites were live on main (openapi.go Load fetch and API.Call, io.LimitReader at 32<<20 with no over-cap check).
    • PR fix(mcpx/openapi): refuse specs and call responses past the 32MiB cap (#8271) #10949 MERGED (45a2314): the cap is named as defaults.OpenAPISpecBodyLimit (recorded defaults constant per the issue's fix shape); both sites now read cap+1 and fail with a clear "exceeds the 33554432-byte limit" error, following the provider paths' pattern. The os.ReadFile local-path branch is untouched (not peer bytes).
    • Tests, oracle = Design: read it bounded — one response-read contract for mcpx's outbound calls #4375 contract decision 2: over-cap refusal at both sites + the exactly-at-cap boundary (read whole, fails as parse, not over-cap); full internal/openapi package passes on the laptop worktree; gofmt clean.
    • Pre-existing, unrelated: internal/defaults' TestNoPackageRedeclaresADefault fails identically on clean main (flags internal/elicit/presence.go's DefaultAudienceWindow) — recorded on the PR, left for its own follow-up; the new constant lives in internal/defaults and is not flagged.
    • Review bots produced no findings (Codex usage limits, CodeRabbit rate limit; zero inline comments on the PR).

    Issue #8271 closed by the merge.

  5. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: done
    task: 20132
    lane: any-n
    worker: repo-worker-code

    Freshly revalidated #8271 as CLOSED with status:done. The existing completion record confirms PR #10949 merged at 45a2314 and the issue was closed by that merge. Queue task 20132 completed as already_done; no implementation or duplicate follow-up was needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)epic/mcpx-platformReprioritization program epic (2026-11-12)status:done

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions