Skip to content

fix(registry): raise brand.json size cap to 2 MiB on all fetch paths - #8057

Merged
bokelley merged 3 commits into
mainfrom
conductor/33-pull-7998-registry-accept-brandjson-files-la
Oct 9, 2026
Merged

bokelley merged 3 commits into
mainfrom
conductor/33-pull-7998-registry-accept-brandjson-files-la

Conversation

@bokelley

@bokelley bokelley commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7998

Maintainer decision: raise the brand.json size cap on all paths, including the signing trust-root fetches in security.mdx, not only the registry live read.

Evidence for the number

I probed real hosts: pg.com serves a 9 KB document, and the AgenticAdvertising.org mirror of nike.com is 851 bytes. nike.com/.well-known/brand.json itself returns a 404 HTML page of about 561 KB, not a brand.json. So I found no real brand.json over 256 KiB, and the 2 MiB figure rests on the maintainer's stated need, not on a measured file. Nothing I measured argues against 2 MiB.

Changes

  • Server/registry: one shared BRAND_JSON_MAX_RESPONSE_BYTES (2 MiB) used by brand-manager.ts and addie/mcp/brand-canonical-tools.ts.
  • security.mdx: the brand.json body cap is now 2 MiB at :230, :1041, :1363, :1380 and the quickstart MAX_BRAND_JSON_BYTES. JWKS and capabilities caps are unchanged.
  • Mitigations paired with the larger cap (spec text):
    • The cap is a streaming limit: abort on exceed, never buffer-then-check, apply to decoded bytes, and never read past 2 MiB.
    • The 5 s connect and 10 s total deadlines stay; the total covers the body read.
    • New MUST: JSON nesting depth of 32 during strict parsing.
    • New MUSTs: cheap checks before the fetch, and a bound on concurrent trust-root fetches.
    • New MAY: negative-cache cap, depth and duplicate-key failures for 60 s.
    • New SHOULDs: Accept-Encoding: identity, node-count bound, ETag revalidation, single-flight.
    • Fixed the strict-parser examples: secure-json-parse and DisallowUnknownFields do not detect duplicate keys.
  • brand-json.mdx: brand.json SHOULD stay under 2 MiB.
  • Migration guide (3.2 to 3.3): new section and checklist row stating that a verifier still enforcing 256 KiB rejects large brand.json files, with an SDK caveat and operator guidance to keep agents[]/key documents small while peers are on 3.2.
  • Changeset: minor. The scope check passes.
  • e2e script and specs doc: scripts/e2e-resolve-training-agent.ts now streams with a byte cap and does a real duplicate-key and depth check. specs/brand-identity-trust-split.md is reworded.
  • Tests: the registry cap test accepts 1 MiB and rejects 3 MiB, and checks that an endless body is aborted, not buffered.

Security review

The security-reviewer signed off after one round of changes. Open items it raised, deliberately not in this PR:

  • Registry cache memory: BrandManager.validationCache retains parsed raw_data for up to 200 entries; a bloated 2 MiB document could retain tens of MB each. Needs a size-aware cache, as a follow-up.
  • SDK clamp: the published @adcp/sdk 14.2.0 clamps brand.json to 256 KiB, so those verifiers reject large files until an SDK release. Noted in the migration guide.
  • Test vector: a 2 MiB test vector with a duplicate key at depth is not added.

🤖 Generated with Claude Code

Share one BRAND_JSON_MAX_RESPONSE_BYTES (2 MiB) between the registry
validator and Addie's brand tools so large brand houses can be confirmed
live. Document the 2 MiB / 256 KiB guidance in brand-json.mdx; the
security.mdx signing-trust-root budgets are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Oct 8, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — raises the brand.json registry live-read cap (256 KiB → 2 MiB) and centralizes the previously-duplicated constant into one shared BRAND_JSON_MAX_RESPONSE_BYTES in brand-resolution-cache-policy.ts.

Checked:

  • Signing trust-root path is unaffected: the 256 KiB cap for key verification still lives in security.mdx step 4 (:1363), and the new doc note (brand-json.mdx:9) correctly directs operators carrying agents[]/keys there. Both raised usages (brand-manager.ts:497,652; brand-canonical-tools.ts:375) are registry/Addie resolution, not key verification.
  • New brand-manager-response-cap.test.ts exercises 1 MiB accept / 3 MiB reject through the real safeFetchAxiosLike; the /exceeded/i assertion matches the live error string (url-security.ts:722).
  • No schema change under static/schemas/source/, so no schema↔docs drift and no changeset required (docs/brand-protocol is non-normative, outside docs/reference/). Fetch retains its 10s timeout and streamed cap.

Decision rationale: brand-canonical-tools.ts is high-risk (modified, matches server/src/addie/**), but the reviewer surfaced no medium-or-higher findings, so row 5 does not fire. gated_paths is false and no no-auto-approve team match. With zero findings, none of rows 1–8 apply; falls through to row 9 → approve. (review_decision REVIEW_REQUIRED does not block since gated_paths is false.)

Raise the brand.json body cap from 256 KiB to 2 MiB in the signing
trust-root fetches in security.mdx as well as the registry live read.
JWKS and capabilities caps are unchanged. Specify the cap as a streaming
limit and add depth, concurrency, and cheap-checks-first mitigations.
Document the interop asymmetry in the 3.2 to 3.3 migration guide.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@bokelley bokelley changed the title fix(registry): raise brand.json live-read cap to 2 MiB fix(registry): raise brand.json size cap to 2 MiB on all fetch paths Oct 8, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — brand.json body cap raised from 256 KiB to 2 MiB.

Checked:

  • Changeset correctness: minor changeset is correct — loosening a size cap is a non-breaking (backward-compatible) change, and the changeset documents the forward-compat asymmetry.
  • Docs↔constant consistency: 2,097,152 bytes used consistently across security.mdx, brand-json.mdx, the 3.2→3.3 migration guide, the trust-split spec, the server cache-policy constant comment, and the e2e resolution script.
  • assertStrictJson scanner: correct per-object dedup and depth-32 enforcement.
  • Streaming-abort operability: byte-counting cancel plus a new endless-stream test covers the new branch.
  • No schema (static/schemas/source/**) changes, so schema↔docs coherence and oneOf discriminator rules do not apply. No released-artifact (dist/**) modifications.

High-risk flag is true only via (modified) entries (docs/reference migration guide and addie MCP tools), but the reviewer surfaced no critical/high/medium findings, so the modifications are presumed safe. No deletions. No no-auto-approve team match. gated_paths is false. No blocking triggers fired — falls through to row 9.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve.

Two editorial coherence fixes in docs/building/by-layer/L1/security.mdx: (1) reclassifies the 2 MiB brand.json body cap from "recommended" to normative to match the already-present "Verifiers MUST NOT read more than 2 MiB" MUST; (2) adds "nesting deeper than 32" to the request_signature_brand_json_malformed error row to match the step-4 MUST on max nesting depth. Both align table/budget wording with MUSTs already present in the prose — no new normative requirement, no schema change, no wire change, no docs/reference normative surface touched.

Checked:

  • No critical/high/medium findings (reviewer reports none).
  • high_risk: true but reasons are (modified) on docs/reference/** and server/src/addie/**; with no medium-or-higher finding on those modified files, row 5 does not fire. No (deleted) reason — row 3 does not fire.
  • gated_paths: false — row 2 does not apply despite review_decision: REVIEW_REQUIRED.
  • No no-auto-approve team match — row 7 does not apply.
  • Prior decision was approve, so sticky-escalation row 6 does not apply.
  • Editorial-class change (aligning docs to existing MUSTs), not a breaking-class change — the breaking-change hard gate does not trigger.

No row 1–8 condition fires; falls through to row 9.

@bokelley
bokelley merged commit a73443c into main Oct 9, 2026
34 checks passed
@bokelley
bokelley deleted the conductor/33-pull-7998-registry-accept-brandjson-files-la branch October 9, 2026 00:56
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.

Registry: accept brand.json files larger than 256 KB on live reads

1 participant