Repository navigation
fix(discovery): origin-only authorized_agents entries match any path under AdCP 3.3 - #3710
Conversation
…under AdCP 3.3 adcontextprotocol/adcp#8939 (adcp#8862, DR-0023) makes an origin-only authorized_agents[].url authorize the agent at that origin whatever its path; an entry with a path keeps exact canonical-URL matching. resolveAgentProperties gains an adcpVersion option (default: the SDK pin) and applies the rule at 3.3 or later, preferring an exact entry over an origin-only one. New agentUrlMatchesAuthorizedEntry and usesOriginOnlyAgentMatching expose the rule. PropertyCrawler matches under each agent's served release, else its new adcpVersion option. Supply-path verification stays exact under semantics v1 (adcp#8943). Closes #3695 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — AdCP 3.3 origin-only authorized_agents[].url matching (adcp#8943, DR-0023).
Checked:
- Core matching in
resolve-agent-properties.ts: exact preferred over origin (L298), origin matching gated onentry.origin === agent.origin(different port/scheme/subdomain/suffix fail per negative test matrix L494-510), duplicate-exact and duplicate-origin both fail closed asambiguous_agent_url. - Version gate
usesOriginOnlyAgentMatchingfails closed to exact matching on unparseable/<3.3 versions; default follows SDK pin, documented in changeset + migration-16-to-17.md. - PropertyCrawler keys
servedVersionsbyagent_url, populated in Step 1 before Step 3 matching, with crawler-pin fallback. - Supply-path legs stay exact (semantics v1); evaluate.ts/validation.ts changes are comment-only.
- Changeset present and correctly typed
minor(additive exports + optional param) — satisfies changeset-vs-wire-impact; minor-release backward pathway honored since prior minor falls closed to exact matching. - 378-line test file covers normalization, IDN, ambiguity, 3.2-vs-3.3 split, crawler negotiation, supply-path exactness.
Gates: gated_paths false; high_risk false; no no-auto-approve team match; no prior decision. Reviewer found no Critical/High/Medium findings. No decision-table row 1-8 fires → row 9 approve. (review_decision REVIEW_REQUIRED does not block since gated_paths is false.)
Aligns with the server PR adcontextprotocol/adcp#9011 and URL canonicalization step 2: at AdCP 3.3 the authorized_agents[].url matcher removes one trailing root-label dot from a DNS host on both the entry and the agent, and a host ending in more than one dot matches nothing. canonicalizeAgentUrl is unchanged, so 3.2 exact matching and its other callers stay byte-identical. Adds userinfo-rejection tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — subsequent pass, prior approve stands.
This is a follow-up pass on PR #3710. The delta adds trailing-root-dot normalization (stripRootDot) and locks in userinfo rejection across AdCP 3.2/3.3 with 48 test cases. The reviewer verified the IPv6 [-guard, url.slice(origin.length) prefix safety, port preservation, and the fail-closed (>1-dot / .-only → null) path feeding matchCanonicalAgentUrl. The 3.2 path remains byte-identical via the !originOnlyMatching short-circuit, and userinfo rejection pre-exists at parseAgentUrl.
Changeset is minor, correctly matching the new exports/options — changeset-vs-wire-impact is satisfied. No witness-not-translator concerns. No new findings.
Decision table: no critical/high/medium findings (row 1, 4, 5, 8 don't fire); gated_paths is false (row 2 n/a despite REVIEW_REQUIRED); high_risk is false (rows 3, 5 n/a); prior decision was approve, not escalate (row 6 n/a); no no-auto-approve team match (row 7 n/a). Falls through to row 9 → approve.
…ntry at 3.3 Matches the server (adcontextprotocol/adcp#9011): at AdCP 3.3 or later every authorized_agents entry that matches an agent authorizes it, and the agent's scope is the union of theirs. An exact entry and an origin-only entry, or two origin-only spellings of one origin, now combine properties, cross_publisher and cross_publisher_expanded instead of "exact wins" or ambiguous_agent_url. New matched_entries lists every matching entry so callers can read per-entry fields such as signing_keys. Below 3.3 the resolver is byte-identical to before. 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.
This PR reverses prior fail-closed-on-ambiguous semantics to union-of-all-matching-entries at AdCP 3.3+, driven by spec adcontextprotocol/adcp#9011 (DR-0023). Verified:
- Witness fidelity: 3.2-and-below unchanged (exact-match-only,
ambiguous_agent_url), new behavior gated onusesOriginOnlyAgentMatchingwith a documented pathway back — satisfies the minor-release pathway-back requirement (DR-0033). unionAgentScopes/uniqueByValuededup correctly by reference and JSON value; empty-union reason,matched_entry(first-in-document-order), andmatched_entriesall match new tests.- Changeset present and correctly typed
minor, matching the backward-compatible wire change — changeset-vs-wire-impact satisfied. - Migration doc updated; no stale doc links flagged.
No Critical/High/Medium findings. Prior decision was also approve on an earlier head. No author-team gate, gated_paths: false, high_risk: false. Decision table falls through to row 9.
…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 pending #3710 changeset no longer says 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]>
Closes #3695
Needed for the AdCP 3.3 RC (Mon Nov 16). This is the SDK side of adcp#8943, with the server side in adcp#9011. It implements the rule adcp#8939 documents under DR-0023.
The rule
authorized_agents[].urlwhose canonical form has the root path and no query (https://agent.example.comorhttps://agent.example.com/) matches any agent URL with the same canonical origin, includinghttps://agent.example.com/mcp./mcpvs/mcp/) and the query stay significant.Normalization
Both sides go through the existing
canonicalizeAgentUrlfirst.:443for https,:80for http)https://a.examplevshttps://a.example/)https://a.example.)?canonicalizeAgentUrlreturnsnull)The root-dot rule lives inside the matcher, not in
canonicalizeAgentUrl. That keeps the canonicalizer's other callers unchanged: format ids, supply-pathagentIdentityand the v2 projections. 3.2 matching also stays byte-identical. The rules match adcp#9011.Several matching entries: union (matches adcp#9011)
At 3.3 or later, every
authorized_agentsentry that matches an agent authorizes it, and the agent's scope is the union of theirs. Two examples:What this means for the result:
properties,cross_publisherandcross_publisher_expandedcombine, with duplicates removed. A narrower entry never removes scope that another matching entry grants.unresolvableis set only when the union is empty. It then carries the first matching entry's reason.matched_entrieslists every matching entry in document order.matched_entrystays the first one.Below 3.3 the resolver is byte-identical to before: only exact canonical matches count, and two of them still fail closed as
ambiguous_agent_url.matched_entriesis not set below 3.3.signing_keys. The SDK resolver does not read or combine signing keys; it never did. Callers that need them read the entries frommatched_entries. The server'sgetPublishersForAgentDetailreportssigning_keys_pinned: truewhen any matching entry has a non-emptysigning_keys(signingKeysPinnedByPublisher, using itsagentUrlAuthorizedBymatcher). Thematched_entriesdoc comment records that rule, so an SDK caller can reach the same answer.fetchAgentAuthorizationsFromDirectoryalready passes the server's flag through unchanged.Version gate
The gate reuses the SDK's existing
isAdcpVersionAtLeast(version, '3.3.0-beta.0'). The other 3.3 gates use the same threshold, so every 3.3 prerelease counts.resolveAgentProperties(adAgents, agentUrl, { adcpVersion }). The new optionaladcpVersiondefaults to the SDK pin,ADCP_VERSION(3.3.0-beta.6), the same default the clients'adcpVersionoption uses. A caller on a 3.2 session passes'3.2'. An unparseable version fails closed to exact matching.PropertyCrawler. It matches each agent under the release that agent served forget_adcp_capabilities. When the agent reports none, it uses the newadcpVersioncrawler option, which defaults to the SDK pin and is also passed to the agent's client.Changes
src/lib/discovery/resolve-agent-properties.tsagentUrlMatchesAuthorizedEntry(entryUrl, agentUrl, { adcpVersion })andusesOriginOnlyAgentMatching(adcpVersion?).resolveAgentPropertiestakes{ adcpVersion }and, at 3.3+, unions the scope of every matching entry (see below). Newmatched_entrieson the result.src/lib/discovery/property-crawler.tsadcpVersionoption.src/lib/index.ts,src/lib/entrypoints/discovery.tsAgentUrlMatchOptionsfrom the root and from@adcp/sdk/discovery.src/lib/supply-path/validation.ts,evaluate.tssrc/lib/discovery/validate-adagents.tsvalidateAdAgentslocates and loads the file and does no agent matching, so the docs point atresolveAgentProperties.docs/migration-16-to-17.mdtest/lib/authorized-agent-origin-only.test.js.changeset/authorized-agents-origin-only.mdminor: new exports and options.verify_agent_authorizationnamed in the issue is the Python SDK's function (adcp-client-python). This repo's equivalent isresolveAgentProperties. The Python SDK is not changed here.Tests
test/lib/authorized-agent-origin-only.test.jshas 53 cases:/?tenant=acmeand an empty?are not origin-only;https://a.example.matcheshttps://a.example/mcpat 3.3,https://a.example..matches nothing, and a dotted entry against a dotted agent at 3.2 stays exact;case-sensitive-agent-pathvector still failsowner_agent_declared, with a passing control.Verification
All of these pass locally:
npm run typecheck,npm run build:lib,npm run format:check,lint:boundariesandci:docs-check.npm run lint, with 0 errors.test:lib:fast: 22,562 tests, 0 failures.🤖 Generated with Claude Code