Skip to content

feat(discovery): resolvePublisherSigningKeyPin combines signing_keys across matching entries - #3713

Merged
bokelley merged 3 commits into
mainfrom
fix/9016-signing-keys-multi-match
Nov 14, 2026
Merged

bokelley merged 3 commits into
mainfrom
fix/9016-signing-keys-multi-match

Conversation

@bokelley

@bokelley bokelley commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

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's adagents.json matches 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:

  • the publisher pins the agent only if every one carries signing_keys;
  • the pin is then the union of their keys;
  • an entry that authorizes nothing for the message never pins or unpins it;
  • a message about several properties must satisfy each property's pin;
  • the earliest revoked_at on any copy of a key applies.

What the SDK does with adagents signing_keys today

The SDK makes no pin decision from adagents.json on its own:

  • webhook publisherPins are supplied by the caller;
  • supply-path/evaluate.ts only lists signing_keys as an understood field;
  • web-bot-auth.ts's signingKeys are the signer's own keys;
  • signing_keys_pinned is passed through from the AAO directory.

So this PR adds a helper and documentation. No existing behaviour changes.

Changes

  • New resolvePublisherSigningKeyPin(adAgents, agentUrl, { adcpVersion, at, country, propertyIds }), plus PublisherSigningKeyPinOptions, exported from @adcp/sdk and @adcp/sdk/discovery.
    • Which entries count. Entries must match the agent (origin-only at 3.3+) AND authorize the message. Entries that resolve to nothing (missing_authorization_type, missing_selector, no_match, unknown_authorization_type) are skipped, as are signals-only entries, entries outside their effective window at at, and entries for another country. A country-limited entry needs a country to count.
    • Several properties. With 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.
    • Return values. undefined means 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. PublisherSigningKeyPin already treats [] as "accept no key", and a test covers it end to end. The JSDoc example builds signingKeys and refresh from the same scoped call.
  • AuthorizedAgent gains optional signing_keys, countries, effective_from and effective_until.
  • Docs:
    • matched_entries documents the scope-qualified rule and points at the helper;
    • AgentDirectoryPublisher.signing_keys_pinned is described as a scope-agnostic summary;
    • docs/migration-agent-resolution-3.3.md and docs/migration-16-to-17.md are updated.
  • Release note: fix(discovery): origin-only authorized_agents entries match any path under AdCP 3.3 #3710 shipped in 17.0.0-beta (chore: release package (beta) #3712) with the note that the AAO registry pins on any matching entry. Released changesets and the CHANGELOG are left alone; the new minor changeset says it supersedes that note.

Tests

test/lib/publisher-signing-key-pin.test.js (34 tests, all passing). It covers:

  • URL cases, mirroring the server's SIGNING_KEY_CASES: both orders, the union, overlap, other paths, and single exact entries.
  • Entries that authorize nothing don't count:
    • an unpinned entry for another country;
    • an expired entry, and one not yet effective;
    • a signals-only entry;
    • entries with a missing selector, no match, or an unknown type.
  • Per-property pins: an unpinned entry for X doesn't unpin Y; pins intersect; disjoint pins give []; an uncovered property gives [].
  • Fail-closed []: agent not listed, 3.2 ambiguous, a country-limited entry with no country, only expired entries, an unparseable URL.
  • 3.2 behaviour and null entries.
  • Revocation in both orders, end to end through assertPublisherPins with a real Ed25519 key. Also that [] is rejected and undefined accepts the JWKS key.

Local checks:

  • tsc --project tsconfig.lib.json --noEmit is clean.
  • eslint and prettier pass, and generated agent docs are unchanged.
  • authorized-agent-origin-only, resolve-agent-properties and agent-directory tests pass (113).

🤖 Generated with Claude Code

@aao-secretariat

Copy link
Copy Markdown

Ladon cannot review this PR until merge conflicts are resolved.

@bokelley
bokelley force-pushed the fix/9016-signing-keys-multi-match branch from 934112a to 2f43f08 Compare November 14, 2026 16:32
…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]>
@bokelley
bokelley force-pushed the fix/9016-signing-keys-multi-match branch from 2f43f08 to 586c52b Compare November 14, 2026 16:32

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 matching PublisherSigningKeyPin.signingKeys (undefined = no pin, [] = accept none).
  • The safe signing_keys! assertion guarded by every(... 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.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 14, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 returns undefined (not []) for no pin — matching assertPublisherPins/matchingValidity semantics (undefined → [Infinity] accept-any vs [] accept-none).
  • Witness-not-translator respected: no fabrication or re-shaping.
  • Changeset correctness: minor is correct for a new additive export + optional signing_keys field. Both @adcp/sdk and /discovery exports 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]>
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 14, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 (invalid at→NaN→excluded, unresolvable entry→empty scope→excluded, unauthorized→[] "accept no key" vs undefined "no pin"). Per-property path intersects over pinned properties only (L254-263, intersectPins L277-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]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 regenerated src/lib/registry/types.generated.ts (timestamp bump + identical description text). No wire shape, enum, union variant, or behavior change.
  • Changes align getAgentDomains/getPublishersForAgent/getAgentAuthorizations descriptions with AdCP 3.3 origin-only authorized_agents[].url matching (DR-0023). No witness-not-translator concern.
  • Doc links are relative (not blob/main/tree/main), so ci:doc-links is out of scope — no stale-link finding.
  • Generated file is correctly excluded from the changeset mandate; a .changeset/*.md is present.
  • High-risk flag is true only because schemas/registry/registry.yaml is (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 was approve on an earlier head; this delta remains clean.

No critical/high/medium findings. Rows 1–8 do not fire → row 9 approve.

@bokelley
bokelley merged commit eb59540 into main Nov 14, 2026
45 checks passed
@bokelley
bokelley deleted the fix/9016-signing-keys-multi-match branch November 14, 2026 21:40
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.

1 participant