Repository navigation
fix(training-agent): accept the training governance service's own tokens at governed tenants - #7757
Conversation
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean, correctly-scoped training-agent fix.
What I checked:
- Change is confined to
server/src/training-agent/**plus unit tests — no protocol surface (static/schemas/source/**), nodocs/reference/**, nodist/**artifacts, no version bump, nooneOfchange. No changeset required. - Governed tenants now accept the training governance service's own tokens by pinning the deployment's governance issuer and single published signing key; fail-closed posture preserved (
allowLocalVerificationKeysstays false, revoked demo kid rejected). TRAINING_AGENT_URLswap is value-identical;getTrainingGovernanceIssuercentralization is a no-op rename; self-authoritycreate_media_buypath runs in-process, verified by tests asserting the network client is never dialed.
Decision path: No critical/high/medium findings (rows 1, 4, 5, 6, 8 don't fire). gated_paths is false (row 2 n/a). high_risk is false (rows 3, 5 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 the gated-paths gate (row 2) only applies when gated_paths is true, which it is not here.
One Low follow-up noted (in-process check errors mapped to transient GOVERNANCE_UNAVAILABLE, sandbox-only impact) — non-blocking.
…ens at governed tenants With a governance authority registered through sync_governance, the governed tenants (sales create/update_media_buy, signals activate_signal, creative build_creative) required iss to equal the registered URL and resolved the key only through buyer brand.json. The seller allowlist's entry for the training agent's own governance service (https://test-agent.adcontextprotocol.org) never matches what the /governance tenant signs (${canonical base}/governance), so its own tokens were always rejected, locally and in production. For that single self entry, governed tenants now expect exactly this deployment's governance issuer and verify only against the one governance key this deployment publishes; local demo keys stay disallowed and every other authority keeps the byte-for-byte iss rule and remote discovery. The create_media_buy online execution check consults the deployment's own governance tenant in process for the self authority instead of dialing the registered locator over the network. The governance issuer now has one source, getTrainingGovernanceIssuer(), used by the signer and verifiers. Closes #7742 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
3d55778 to
feab1c0
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean fail-closed security refactor to the sandbox training agent's governance-token verification.
What I checked:
- The delta teaches the training agent to accept its own
/governancetenant as a registered authority (#7742) while preserving byte-for-byte issuer/audience checks and remote key discovery for every third-party authority. Self-authority is verified against the deployment's own issuer and single published signing key withallowLocalVerificationKeys: false. - New tests prove the wrong-base, wrong-audience, revoked-demo-key, and third-party rejection boundaries all still fail closed.
- All changes are under
server/**app code — no protocol surface (static/schemas/source/**,docs/reference/**,dist/**), so no changeset required per repo scope rules. - No high-risk paths, no gated paths (and
review_decisionis APPROVED regardless), no no-auto-approve team match.
Findings: none (no critical/high/medium). Prior decision was also approve with no findings — this run confirms the clean state.
Rows 1–8 do not fire; falls through to row 9 → approve.
Closes #7742
Refs #7741, which is not fixed here: its routing is still blocked by the SDK, even on
@adcp/sdkrc.50. See "Where #7741 stands" below.The branch is rebased onto
mainat080cdcebf(#7759, the@adcp/[email protected]bump). The results below are from that base unless marked otherwise.Root cause
When a buyer registers a governance authority through
sync_governance, the governed tenants verify the token withiss === <registered authority URL>. They get the key only through the buyer's brand.json, and local keys are off. This coverscreate_media_buy/update_media_buyon sales,activate_signalon signals andbuild_creativeon creative.The seller allowlist's entry for the training agent's own governance service is
https://test-agent.adcontextprotocol.org. The storyboards register that URL asgovernance_agent_url. The/governancetenant signs as${getCanonicalBase()}/governance:https://agenticadvertising.org/governance(CANONICAL_GOV_ISS);http://localhost/governance, or the local origin whenTRAINING_AGENT_URLis set.So the tenants never accepted the governance tenant's own tokens:
governance_context issuer does not match the registered governance authority. This isn't only a local problem. The same mismatch happens in production. Even with a matchingiss, the key lookup would still fail, because the fictional buyer brand (acmeoutdoor.example) has no brand.json.acquire_rightson brand never looks at the registered authority and already expects${getCanonicalBase()}/governance, so brand only hit the audience half.The audience half is on the runner side. The governed tenant verifies
aud === ${getCanonicalBase()}/<tenant>. The storyboards' defaulttarget_agentcontext value ishttps://test-agent.adcontextprotocol.org/<tenant>, and their prerequisites say the runner must override it with the endpoint under test. The harness doesn't do that yet. That override belongs with the #7741 routing work. The verifier's audience check is correct and is not changed here.Reproduced with a routed run of the three
governance_approvedstoryboards (throwaway diagnostic, see below):ississ(before)audaudactivate_signalhttp://localhost/governancehttps://test-agent.adcontextprotocol.org/https://test-agent.adcontextprotocol.org/signalshttp://localhost/signalsbuild_creativehttp://localhost/governancehttps://test-agent.adcontextprotocol.org/https://test-agent.adcontextprotocol.org/creative-builderhttp://localhost/creative-builderacquire_rightshttp://localhost/governancehttp://localhost/governancehttps://test-agent.adcontextprotocol.org/brandhttp://localhost/brandFix
getTrainingGovernanceIssuer()(canonical-base.ts) is now the only source for the governance issuer. The signer (check_governance) and every verifier use it.isTrainingSelfGovernanceAuthority()(account-handlers.ts) matches only the allowlist entry for the training governance service.allowLocalVerificationKeysstaysfalse, so the local revoked demo key is still rejected.issmust equal the registered URL byte for byte, and the key comes from remote discovery.aud, caller, phase, task, payload-hash, commitment and replay checks are untouched.create_media_buyonline execution check now goes to the deployment's own/governancetenant in process. The seller authenticates as its canonical${base}/salesidentity. The returned purchase token is verified with the same issuer/key rule.Production values don't change. The issuer is still
https://agenticadvertising.org/governance, and the advertisedaccepted_governance_agentslist is unchanged. The one behavior change is that a correctly bound token from the production governance tenant is now accepted when the buyer has registered the training governance service. Before, that token was always rejected.No changeset: this is training-agent code only, with no protocol surface.
Tests
New cases in
server/tests/unit/training-agent.test.ts("with the training governance service registered as the authority (#7742)"):activate_signalaccepts the tenant's own token (iss = <base>/governance,aud = <base>/signals), andcreate_media_buycompletes through the in-process execution check.CANONICAL_GOV_ISS.https://test-agent.adcontextprotocol.org/signalsis rejected (audience);https://governance.example/mcp) still getsissuer does not matchfor a self-issued token.Verification
npx vitest run --config server/vitest.config.ts server/src/ server/tests/unit/{training-agent*,account-handlers*,storyboard-runner*,governance*}: 40 files, 1419 tests passed on rc.50 (38 files, 1395 tests on rc.49 before the rebase).npm run typecheck: passed.node --test tests/test-coverage-registration.test.cjs: passed. No new test files.Storyboards, harness as on
main(ADCP_COMPLIANCE_DIR=dist/compliance/latest):mainon rc.49.ADCP_SCHEMA_ROOTas the matrix uses.The rows match, as expected: routing isn't enabled, so nothing here reaches the changed path.
signal_marketplace/governance_approvedbrand_rights/governance_approvedcreative_transformers/governance_approvedmedia_buy_seller/governance_approvedmedia_buy_seller/governance_conditionsmedia_buy_seller/governance_deniedmedia_buy_seller/governance_denied_recoveryreporting_coremedia_buy_seller/account_change_feedmedia_buy_seller/governance_agent_binding_acceptancepagination_integrity_list_accountssales_guaranteedsignal_marketplacesignal_marketplace/governance_deniedbrand_rightsbrand_rights/governance_deniedcreative_transformers/governance_deniedgovernance_spend_authoritygovernance_spend_authority/deniedgovernance_delivery_monitor* The before run had no built
ADCP_SCHEMA_ROOT, so theget_capabilitiesschema check failed locally. With the schema root set, both storyboards are clean on rc.49 as well.Routed diagnostic runs, with the #7742 fix and the #7741 routing held back from this PR. The SDK blockers were bypassed locally only to reach the governed calls. The tokens'
issandaudnow equal the governed tenant's expected values foractivate_signal,build_creative,acquire_rightsandcreate_media_buy. On@adcp/sdkrc.49,brand_rights/governance_approvedruns 7P, clean, with issues A and B below bypassed, andmedia_buy_seller/governance_deniedruns 5P, clean, with A bypassed. The #7742 unit tests and typecheck also pass on@adcp/[email protected].No floors change.
Where #7741 stands (not in this PR)
I built routing for
requires: [multi_agent]storyboards (branchwip/7741-multi-agent-routing, local for now):default_agentmust be the tenant under test;signal_agent_url,seller_agent_url, ...) gets that tenant's service identity, which the storyboards' prerequisites ask the runner to supply;@adcp/[email protected]fixes adcontextprotocol/adcp-client#3047 and #3044, but routing still can't land. Results with routing on rc.50 (branchwip/7741-multi-agent-routingon the same rc.50main):signal_marketplace/governance_approvedbrand_rights/governance_approvedcreative_transformers/governance_approvedmedia_buy_seller/governance_approvedmedia_buy_seller/governance_conditionsmedia_buy_seller/governance_deniedmedia_buy_seller/governance_denied_recoverymedia_buy.governance_awareWhat blocks them:
requires_capability, which describes the governed agent, to each routed step's own agent. Every governance-agent step (sync_plans,check_governance, ...) is therefore skipped asnot_applicable, and the governed call cascades to a skip. This isevaluateStoryboardCapabilityGates(storyboard, selected.profile, ...)in the routed pre-pass. It is still present in rc.50 and has no issue yet.adcp_version/adcp_major_versionto the downstream governed request but not tocheck_governance.payload. The payload hash excludes exactlygovernance_contextandcontext, so the service correctly rejects the call with "The governed task payload does not match the signed authorization." Seen oncreate_media_buy,activate_signal,build_creativeandacquire_rights.build_creativerequest builder mergesbrand,quality: "draft"andinclude_preview: trueinto the authored request after the payload was approved.get_signalsreadback reports only the agent deployment, so a liveplatformdestination activation isn't visible.Turning routing on now would drop the signals clean count by one. It would also report the others as clean while skipping the governed call, so it stays off until A and B are fixed. The
account_change_feedbrandFromKitexclusion from #7716 passes 17/17 without it on rc.50. I removed it on the WIP branch, because it can only go once rc.50 is merged.🤖 Generated with Claude Code