Repository navigation
fix: restore closed-schema guarantees under AdCP 3.3.0-beta.6 - #3705
Conversation
AdCP 3.3.0-beta.6 opened schemas (adcontextprotocol/adcp#8866) that the SDK relied on to keep undeclared data out of responses, stored evidence and webhook payloads. - Project account identity objects, reporting delivery states and notification_configs to their declared members; refuse retained secrets. - Refuse undeclared managed-delivery evidence members in reporting-storage (new undeclaredReportingMaterializationMembers on reporting/ledger). - Enforce webhook schema `not` exclusions at any depth, fail closed when a mapped schema is unavailable, and make proposal.offered identifiers-only. - Refuse an unknown single reporting-subscription scope selector; the engine covers every account only for an explicit all_authorized_accounts. - Bound credential scanning and projections by depth (DAG-aware), drop an uninspectable ext/context in scrubExtensions, and drop ingest diagnostics with control characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean review, no blocking findings.
This PR restores the closed-schema guarantees that beta.6 opened (adcp#8866). Reviewer verified the two largest surfaces:
keepDeclared/projectToDeclaredMembersin schema-projection.ts: free-form-map detection correctly keeps declaredextmaps while dropping undeclared members (L172), fail-closed on unresolved$ref(L148), RangeError at depth > MAX_DEPTH=64.assertWebhookExclusionsin notification runtime (L536-572): loader honorsallErrorsin its cache key (schema-loader.ts:1343), sonot-exclusions are reliably caught.
engine.ts memberNow now requires explicit all_authorized_accounts === true, matched by the validateReportingSubscription selector-allowlist fix; both tested. exceedsJsonDepth is iteratively bounded with cycle/alias handling. Credential-scan and scrubExtensions fail closed on too-deep subtrees. Changeset present (minor for both packages, correct under 17 beta pre-mode). Strong test coverage across every new branch.
The sole non-blocking note (depth-guard mismatch at 256 vs RangeError at 64) is not reachable for the bounded structured objects in scope — a low/speculative concern, not a finding.
Decision path: no critical/high findings; gated_paths false; high_risk false; no medium findings; author not on a no-auto-approve team; fewer than three mediums → row 9 approve. (review_decision REVIEW_REQUIRED is informational only since gated_paths is false.)
Summary
Follow-up to the AdCP 3.3.0-beta.6 adoption (#3703). Beta.6 opened schemas the SDK had relied on to keep undeclared data out of responses, stored evidence and webhook payloads (adcontextprotocol/adcp#8866). #3703 refused the known dangerous members by name. This PR restores the closed-schema guarantees in full. It covers the items the #3703 review stacks split out.
projectToDeclaredMembers(internal, built on the version-projection$refand union machinery) strips every member a schema does not declare, at any depth. It fails closed on an unresolved$ref. It keeps an object's undeclared contents only when a schema explicitly types that object as a free-form map, asextis. It is applied after validation to:list_accounts/sync_accountsidentity objects;notification_configs, which also newly refuse a retainedwebhook_secret/authentication.signing_secret, as the other projections already did.@adcp/reporting-storage).assertMaterializationOutcomerefuses adapter evidence with undeclared members, through the newundeclaredReportingMaterializationMemberson@adcp/sdk/reporting/ledger. Its invalid-evidence message no longer quotes Zod messages, which can echo adapter values.not-exclusion failures, at any depth and including conditional ones:access_tokenonreporting.delivery_ready,setup.urlonaccount.status_changed,staged_updateoncreative.status_changed. Partial payloads still emit.proposal.offeredis identifiers-only.sync_principalrefused only a scope with more than one key, so a scope whose only key is an unknown selector passed, and the coverage engine treated it as all authorized accounts. Ingest now refuses it. The engine also requires an explicitall_authorized_accounts: truebefore covering every account.exceedsJsonDepthis iterative and DAG-aware: a deep chain can't hide behind shallow aliases, and cycles count as too deep.<too-deep>hit instead of overflowing the stack, andscrubExtensionsthen drops theext/contextit couldn't inspect.Changeset:
minorfor@adcp/sdkand@adcp/reporting-storage. One behavior change versus 17.0.0-beta.24: undeclared members that used to pass through these projections are now dropped (identity, delivery states, notification configs) or refused (managed evidence). The 16→17 migration note is updated.Security review (REVIEW-STACKS)
Reviews run
security-reviewersubagent on the full diff.scripts/codex-review.sh --persona securityand--persona code, with the diff piped on stdin. codex's sandbox can't run shell on this host, so this was a static review of the diff.Convergence
seenset underestimates depth on shared subtrees. Fixed: it now tracks the greatest depth per node, with a regression test using a long chain behind shallow aliases.Fixed from the Claude review (no High findings)
scrubExtensions. Now the uninspectable container is dropped.notlist missed nested and conditional exclusions, andcreative.status_changed. Replaced by validator-basednotenforcement plus the complete, cross-checked map.notification_configsdepended on closure. It is now projected the same way as the other account records.$ref; undeclaring non-object schemas).ext. None of these schemas declares one, and the docs now say so.Not changed, with reasons
reportingSubscriptionScopeIncludesV1, which already has an unknown-selector test from feat: adopt AdCP 3.3.0-beta.6 #3703, andmembershipOfnow agrees with it.ext) keep their contents by design and stay covered by credential scanning.DELIVERY_FAILEDwithout the reason because the runtime has no logging hook. Adding one is a separate change.Test plan
tsc --noEmit -p tsconfig.lib.json,npm run typecheck:reporting-storage,npm run build:libschema-declared-memberstest and the runtime, projection, wire-safe, credential-policy, ingest and principal-subscription cases@adcp/reporting-storagesuitenpm run test:node:slow), run before the review fixes; CI reruns it🤖 Generated with Claude Code