Repository navigation
feat(discovery): resolvePublisherSigningKeyPin combines signing_keys across matching entries - #3713
Conversation
|
Ladon cannot review this PR until merge conflicts are resolved. |
934112a to
2f43f08
Compare
…across matching entries SDK side of adcontextprotocol/adcp#9016. When more than one authorized_agents entry matches one agent under AdCP 3.3, the publisher pins the agent only if every matching entry carries signing_keys (absent or empty unpins), and the pin is then the union of their keys. The SDK makes no pin decision from adagents.json itself: webhook publisherPins are caller-supplied and supply-path verification only lists signing_keys as an understood field. So this adds a helper and docs: - resolvePublisherSigningKeyPin(scope | entries): undefined for no pin, never [], so it drops into PublisherSigningKeyPin.signingKeys. Uses matched_entries at 3.3+, matched_entry below 3.3. Exported from @adcp/sdk and @adcp/sdk/discovery. - AuthorizedAgent gains optional signing_keys. - matched_entries and AgentDirectoryPublisher.signing_keys_pinned docs state the rule. The changeset supersedes the released 17.0.0-beta note that the registry pins on any matching entry. - Migration docs (agent resolution 3.3, 16 to 17) point at the helper. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2f43f08 to
586c52b
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean, additive PR with no blocking or medium findings.
This PR adds resolvePublisherSigningKeyPin(scope) implementing adcp#9016: pins only when every matching authorized_agents[] entry pins, returning the union of keys in document order with fail-closed semantics (any unpinned matching entry → undefined). Reviewer verified:
- The never-
[]contract matchingPublisherSigningKeyPin.signingKeys(undefined = no pin, [] = accept none). - The safe
signing_keys!assertion guarded byevery(... length > 0). - 3.2 single-entry + ambiguous-URL pathway and union dedup via existing
uniqueByValue. - Revoked-key retention and both export surfaces covered by tests.
- Changeset is
minor— correct for a new export (satisfies changeset-vs-wire-impact).
No witness-not-translator concerns (no fabrication/re-shaping), no new transport reimplementation. Docs are renamed migration files with no reported stale-link findings.
Decision table: no critical/high findings (row 1 n/a); gated_paths is false (row 2 n/a); high_risk false, no deletions (rows 3/5 n/a); no medium findings (rows 4/6/8 n/a); no no-auto-approve team match (row 7 n/a). Falls through to row 9 → approve. Note: review_decision is REVIEW_REQUIRED, but with gated_paths false that does not block approval.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — new additive export resolvePublisherSigningKeyPin (adcp#9016), clean review.
What I checked:
- Core helper logic (resolve-agent-properties.ts:155-166) is correct: fail-closed "pinned only if every matching entry pins," union in document order via existing
uniqueByValue, and crucially returnsundefined(not[]) for no pin — matchingassertPublisherPins/matchingValiditysemantics (undefined → [Infinity]accept-any vs[]accept-none). - Witness-not-translator respected: no fabrication or re-shaping.
- Changeset correctness:
minoris correct for a new additive export + optionalsigning_keysfield. Both@adcp/sdkand/discoveryexports wired. - Test coverage: 137-line test covers both-module export, revoked-copy retention, empty-array guard, 3.2/3.3, and direct-entry input.
- Doc rule flip (adcp#9011 "any" → #9016 "every") is doc-only; no SDK code computes the pin.
No critical/high/medium findings. gated_paths is false, high_risk is false, no no-auto-approve team match. None of decision rows 1-8 fire → row 9 approve. (Note: review_decision is REVIEW_REQUIRED, but with gated_paths: false row 2 does not apply.)
…t authorize the message Review follow-up on adcontextprotocol/adcp#9016. - resolvePublisherSigningKeyPin(adAgents, agentUrl, { adcpVersion, at, country, propertyIds }) counts only entries that match the agent AND authorize the message: they resolve (not unresolvable or signals-only), are in their effective window, and cover the country and each property. An entry that authorizes nothing never pins or unpins. - Per-property pins for a multi-property message, intersected by public key material; revoked copies are kept so the earliest revoked_at applies. - Not authorized (not listed, 3.2 ambiguous, no entry covers the scope or a property) returns [] (accept no key), never undefined (no pin). - AuthorizedAgent gains countries / effective_from / effective_until. - Tests: other-country, expired, signals-only, unresolvable entries, per-property pins, fail-closed cases, and revocation in both orders end to end through assertPublisherPins. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean pass, no blocking or medium findings.
Checked:
resolvePublisherSigningKeyPin(resolve-agent-properties.ts L228-264) is the load-bearing change. It reuses verified helpers and fails closed at every ambiguity (invalidat→NaN→excluded, unresolvable entry→empty scope→excluded, unauthorized→[]"accept no key" vsundefined"no pin"). Per-property path intersects over pinned properties only (L254-263,intersectPinsL277-294), matching the documented adcp#9016 rule.- Witness-not-translator: no mock/fallback injection, no fabricated fields, no silent wire-shape normalization. Clean.
- DR-0033 backward pathway: test file covers both 3.2 and 3.3 pathways; backward path handled. The 288-line test covers union/intersection/revocation/country/window.
- Changeset present and
minor, purely additive — matches wire impact. - No doc-link integrity issues flagged.
Decision table: no critical/high (row 1 n/a), gated_paths false (row 2 n/a), high_risk false (rows 3/5 n/a), no medium findings (rows 4/8 n/a), prior decision was approve (row 6 n/a), no team gate (row 7 n/a). Falls through to row 9 → approve. Note: review_decision is REVIEW_REQUIRED but gated_paths is false, so row 2 does not fire.
The upstream AAO registry spec changed its agent_url matching descriptions in adcontextprotocol/adcp#9011 (origin-only matching); regenerate with npm run generate-registry-types -- --sync so the generated-checks lane passes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — documentation-only delta with no findings.
What I checked:
- Reviewer reports a doc-only delta: prose refinements to directory-API endpoint and field descriptions in
schemas/registry/registry.yaml, mirrored into regeneratedsrc/lib/registry/types.generated.ts(timestamp bump + identical description text). No wire shape, enum, union variant, or behavior change. - Changes align
getAgentDomains/getPublishersForAgent/getAgentAuthorizationsdescriptions with AdCP 3.3 origin-onlyauthorized_agents[].urlmatching (DR-0023). No witness-not-translator concern. - Doc links are relative (not
blob/main/tree/main), soci:doc-linksis out of scope — no stale-link finding. - Generated file is correctly excluded from the changeset mandate; a
.changeset/*.mdis present. - High-risk flag is true only because
schemas/registry/registry.yamlis(modified)— but the reviewer found no medium-or-higher concern, so the modification is presumed safe (row 5 not triggered without a medium finding). gated_paths: false, no no-auto-approve team match. Prior decision wasapproveon an earlier head; this delta remains clean.
No critical/high/medium findings. Rows 1–8 do not fire → row 9 approve.
SDK side of adcontextprotocol/adcp#9016. The spec and server change is adcontextprotocol/adcp#9017.
The rule
When more than one
authorized_agents[]entry in one publisher'sadagents.jsonmatches the same agent under AdCP 3.3, only the entries that both match the agent and authorize the signed message's scope count. Such an entry resolves, is in its effective window, and covers the country and the property. Among them:signing_keys;revoked_aton any copy of a key applies.What the SDK does with adagents
signing_keystodayThe SDK makes no pin decision from
adagents.jsonon its own:publisherPinsare supplied by the caller;supply-path/evaluate.tsonly listssigning_keysas an understood field;web-bot-auth.ts'ssigningKeysare the signer's own keys;signing_keys_pinnedis passed through from the AAO directory.So this PR adds a helper and documentation. No existing behaviour changes.
Changes
resolvePublisherSigningKeyPin(adAgents, agentUrl, { adcpVersion, at, country, propertyIds }), plusPublisherSigningKeyPinOptions, exported from@adcp/sdkand@adcp/sdk/discovery.missing_authorization_type,missing_selector,no_match,unknown_authorization_type) are skipped, as are signals-only entries, entries outside their effective window atat, and entries for another country. A country-limited entry needs acountryto count.propertyIds, each property gets its own pin, and the result keeps only the keys every pinned property allows. Keys are matched by public material, and revoked copies are kept.undefinedmeans the publisher does not pin the agent for this message.[](accept no key) means the agent is NOT authorized: not listed, ambiguous below 3.3, no entry covers the scope, a requested property no entry covers, or the pinned properties share no key. Being unauthorized never reads as unpinned.PublisherSigningKeyPinalready treats[]as "accept no key", and a test covers it end to end. The JSDoc example buildssigningKeysandrefreshfrom the same scoped call.AuthorizedAgentgains optionalsigning_keys,countries,effective_fromandeffective_until.matched_entriesdocuments the scope-qualified rule and points at the helper;AgentDirectoryPublisher.signing_keys_pinnedis described as a scope-agnostic summary;docs/migration-agent-resolution-3.3.mdanddocs/migration-16-to-17.mdare updated.Tests
test/lib/publisher-signing-key-pin.test.js(34 tests, all passing). It covers:SIGNING_KEY_CASES: both orders, the union, overlap, other paths, and single exact entries.[]; an uncovered property gives[].[]: agent not listed, 3.2 ambiguous, a country-limited entry with no country, only expired entries, an unparseable URL.assertPublisherPinswith a real Ed25519 key. Also that[]is rejected andundefinedaccepts the JWKS key.Local checks:
tsc --project tsconfig.lib.json --noEmitis clean.authorized-agent-origin-only,resolve-agent-propertiesandagent-directorytests pass (113).🤖 Generated with Claude Code