Repository navigation
fix(training-agent): let third-party sellers use the public governance agent (#7758) - #7786
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
4f9373a to
c2d197c
Compare
…e agent (#7758) Third-party governance-aware sellers could not complete the governed commit against the public sandbox governance agent in hosted grading: - Seller credential / audience binding: the storyboards register the governance agent with a literal placeholder credential, and the shared public token maps to a per-token identity, so no credential could authenticate as the seller URL the intent is bound to. Add stateless, HMAC-minted sandbox governance-agent credentials (TRAINING_GOVERNANCE_CREDENTIAL_SECRET) that the hosted runner mints for the agent under test and substitutes into its storyboard copy. They authenticate only on the governance tenant, resolve to exactly the bound seller URL, expire within 30 minutes, and may only run execution checks and seller adjustment reports on plans from their own run. - Issuer: governance tokens were signed as `${canonicalBase}/governance` (https://agenticadvertising.org/governance in production) while the storyboards register https://test-agent.adcontextprotocol.org. The issuer is now the training agent's own URL, the revocation list names the same issuer, and POST / on the training agent serves the governance tenant so a seller can call check_governance at the registered URL. - Addie's storyboard output redaction now covers the `credentials` key and the minted credential prefix. No protocol change; training agent and Addie only. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
274717d to
0647ad4
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — sandbox governance-agent credential design (mint/verify, router allowlist, handler-level buyer-side/plan-scope guards, reserved-host mint protection, redaction) plus app-only governance issuer unification. Fail-closed at every layer with strong test coverage on the largest changed files (governance-agent-credentials.ts +289 and its +320 test).
Gate checks:
- No critical/high/medium findings.
- gated_paths: false; review_decision REVIEW_REQUIRED does not force escalation without a gate.
- high_risk true only from a modified match on server/src/addie/mcp/member-tools.ts, but reviewer found no medium-or-higher concerns there (row 5 not triggered).
- No no-auto-approve team match; no deletions in high-risk paths.
- Training-agent/Addie code only — no protocol surface touched, so no changeset required.
Only a single Low note (duplicated issuer constant), not blocking. Rows 1–8 do not fire; falls through to row 9.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean review, no blocking or medium findings.
Checked:
- Auth boundary: governance-tenant-only authenticator, router re-verification and tool allowlist, defense-in-depth handler guards — verified.
- Cross-run/tenant isolation and MAC-before-parse credential verification — verified.
- Issuer coherence across signer/verifier/self-authority/revocation — consistent.
- Changeset scope: correctly omitted; changes are training-agent + Addie only, no protocol surface (
static/schemas/source/**,docs/reference/**, dist artifacts) touched.
Notes on gates:
high_riskis true only viaserver/src/addie/mcp/member-tools.ts (modified), but the reviewer surfaced no medium-or-higher concerns on that file, so the modification is presumed safe (does not trigger row 5).gated_paths: false, so row 2 does not apply despitereview_decision: REVIEW_REQUIRED.- No no-auto-approve team match; no prior decision.
- No breaking protocol/wire change — this is a platform/app change, not a spec change.
None of decision-table rows 1–8 fire; falls through to row 9 → approve.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — no blocking or medium findings.
The reviewer found no Critical/High/Medium issues across this training-agent sandbox governance-agent credentials PR. Verified points: seller identity derives solely from HMAC-signed claims with server-side re-verification; nonce plan-scope and audience binding are not request-spoofable; router allowlist and handler rejections layer correctly; tenant isolation, issuer coherence, redaction, and the fail-closed unset-secret path all hold.
Decision-rule walk-through:
- Row 1 (critical/high): no such findings.
- Row 2 (gated_paths + not APPROVED): gated_paths is false — does not fire despite review_decision=REVIEW_REQUIRED.
- Row 3 (deleted high-risk): no deletions.
- Row 4 (medium data-loss/schema/infra): no medium findings.
- Row 5 (high_risk modified + medium): server/src/addie/mcp/member-tools.ts is (modified) and high_risk, but there are zero medium findings, so this does not fire.
- Row 6 (sticky escalate): no prior decision.
- Row 7 (no-auto-approve team): no team match.
- Row 8 (≥3 medium): zero medium findings.
- Row 9: approve.
App-only change (training agent + Addie); no changeset required, no schema/dist/docs surface touched. high_risk is only a heuristic here and the modified sensitive file carries no findings, so no escalation is warranted.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve.
Checked: PR scopes a stateless HMAC-signed sandbox governance-agent credential to a single seller URL + hosted-run nonce with layered defense — mint-time HTTPS/reserved-host validation, timing-safe MAC verify with a 30-min TTL cap, router re-verification from the Authorization header plus governance-tenant + method/tool allowlist failing closed, and handler-level buyer-side rejection reading the authoritative plan id (governance-handlers.ts:1207). Issuer coherence flows through one getTrainingGovernanceIssuer(). Scope is server/** only, so changeset omission is correct — no schema/docs/dist/oneOf concerns.
Decision path:
- Rows 1–2: no critical/high findings; gated_paths is false, so the REVIEW_REQUIRED status does not trigger the hard gate.
- Rows 3–5: high_risk is true (server/src/addie/mcp/member-tools.ts modified), but there are zero medium-or-higher findings, so the modified-file escalation rows do not fire, nor does any deleted-path trigger.
- Rows 6–8: no prior decision, no no-auto-approve team match, zero medium findings.
- Row 9: approve.
No blocking findings.
… review - Check the seller credential's scope before any plan lookup in check_governance, so it cannot distinguish unknown plans. - Carry the credential scope into handler context whenever present, so its restrictions cannot lapse on an identity mismatch. - Exempt exact POST / from CSRF so an unauthenticated MCP client at the registered governance URL gets the bearer challenge, not a CSRF 403. - Correct the authenticator-order comment. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean subsequent pass with no blocking or medium findings.
This is a follow-up review over the 5-file delta since the prior clean approve. All changes are scoped hardening of the sandbox governance-agent credential path:
governance-handlers.ts— seller-credential gate moved ahead of plan lookup (prevents plan probing), preserving intent-vs-execution routing.custom-tool-helper.ts/v6-governance-platform.ts— credential now always carried so seller restrictions cannot lapse.csrf.ts— exempts the literal root POST via exact match; no cookie route serves POST / on any host.
No protocol surface (static/schemas/source/**, docs/reference/**, dist artifacts) touched, so no changeset is required. Reviewer found no Critical/High/Medium findings.
Gate checks:
- No no-auto-approve team match (HARD RULE clear).
gated_paths: false— path gate (row 2) does not apply despitereview_decision: REVIEW_REQUIRED.high_risk: trueonly from a(modified)file (server/src/addie/mcp/member-tools.ts); no(deleted)reason (row 3 clear) and no medium finding on the modified file (rows 4/5 clear).- Prior decision was
approve, notescalate(row 6 clear). - Zero medium findings (rows 7/8 clear).
Falls through to row 9 → approve.
Part of #7758. This PR fixes two of the three public-governance-agent blockers listed in #7779. The third blocker, and a fourth one found while testing, need decisions (see "Decisions needed").
Reproduced first
I ran these against production
https://test-agent.adcontextprotocol.org/governance/mcpwith the public token (2026-09-30):gov-token-xxxx…credentialcaller= seller URLAuthenticated agent identity … must match callercaller= its own identityExecution governance caller must authenticate as the service audienceisshttps://agenticadvertising.org/governance, while the registered URL ishttps://test-agent.adcontextprotocol.orgOther findings for blocker 3:
issorigin.acmeoutdoor.examplehas no brand.json anywhere, including AAO's/brands/…/brand.jsonand/api/brands/resolve.The new test file reproduces blockers 1 and 2 over HTTP before it checks the fix.
Fixes
Blockers 1 and 2: seller credential bound to the seller URL
New
server/src/training-agent/governance-agent-credentials.tsadds a stateless, HMAC-signed sandbox credential:adcp-sandbox-gov.v1.<claims>.<mac>.sync_governancestep, the same way fix(compliance): route hosted multi_agent governance storyboards to the public governance agent #7779 already rewritescallerand plan ids. The seller receives the credential and presents it oncheck_governance.caller./governance/mcpand the new root route). Every other route returns 401.check_governanceexecution checks andreport_plan_adjustment(report only), and only on plans whose id ends with that run's nonce. The router enforces this with a tool allowlist, and the handlers reject the credential again on every buyer-side operation.${base}/salesor…/authenticated/<hash>.TRAINING_GOVERNANCE_CREDENTIAL_SECRET(32+ characters). With the secret unset, the feature is off: minting throws and nothing verifies. There is no default fallback.credentialskey and the credential prefix. Before this, the existingcredentialkey pattern would have shown the minted value.Blocker 3, issuer half: one governance identity
Governance tokens are now signed with
iss= the training agent's own URL:https://test-agent.adcontextprotocol.org, with no trailing slash.TRAINING_AGENT_URL.This is the URL the storyboards register, and it satisfies the SDK seller helper's byte-for-byte
expectedIssuercheck. The URL is now coherent:POST /on the training agent serves the governance tenant, so a seller can callcheck_governanceat the registered URL. ExactPOST /is now exempt from CSRF so an unauthenticated MCP client gets the bearer challenge (no cookie route handlesPOST /on any host);GET /is unchanged.{origin}/.well-known/governance-revocations.jsonnames the same issuer.${canonicalBase}/<tenant>) and fix(training-agent): accept the training governance service's own tokens at governed tenants #7757's self-authority path are unchanged.I didn't add the governance key to the app-level
/.well-known/jwks.json. That document serves Addie's request-signing keys on every host, and the sandbox governance key can be derived by anyone (security review). Key discovery goes through buyer brand.json, which is decision D below.Decisions needed (not implemented)
Both reviewers agreed these can't be closed without a normative or conformance-program decision.
.exampletest-kit brands.acmeoutdoor.examplecan never resolve./brands/{domain}/brand.jsonin place ofhttps://{domain}/.well-known/brand.jsonfor reserved-TLD test-kit brands, and for which accounts? If not, step 13 can't be graded in hosted runs.callerbinding.verifyGovernanceAuthorizationrejects the token unless itscallerclaim equals the seller's authenticated caller. security.mdx:860 lists that mismatch asgovernance_token_not_applicable, but the 15-step checklist doesn't include it.calleris the identity the governance agent bound to the grader's governance credential. The seller maps the owner's credential to an identity of its own, so the two never match.callerto its authenticated buyer? If yes, what is the canonical buyer agent URL for hosted grading (for examplehttps://compliance-runner.examplefromsigned-requests-runner.yaml)? The runner would then authenticate to governance as that identity. The credential format here supports binding any URL.Separate fixture defect (not changed here):
governance_deniedhas no intent step. A correct seller with a registered governance agent and nogovernance_contextreturnsPERMISSION_DENIED(error-handling.mdx:374), but the fixture assertsGOVERNANCE_DENIED. It also buys on thesandbox: trueaccount, which is not the account governance was registered on.What the #7779 routing and the heartbeat wiring must also do
In production, blockers 1 and 2 close only after the runner mints and substitutes the credential and the secret is set. Nothing in this PR mints it outside tests.
governanceAgentCredentialsEnabled(), then mint per run withmintGovernanceAgentCredential(sellerAgentUrl, { nonce: runNonce }).runNonceis the suffix fix(compliance): route hosted multi_agent governance storyboards to the public governance agent #7779 already appends to the plan ids. Substitute it into everysync_governancestep'sgovernance_agents[].authentication.credentialsin the storyboard copy.sellerAgentUrlmust be byte-identical tocontext.seller_agent_url(the intenttarget_agent/ tokenaud). Mint it from the URL after the SSRF check.governance_agent_urlpinned to the authoredhttps://test-agent.adcontextprotocol.org. That's now the real issuer and the MCP endpoint.TRAINING_GOVERNANCE_CREDENTIAL_SECRET. All machines must share it.Testing
server/tests/unit/training-agent-governance-agent-credentials.test.ts: 9 tests over HTTP against the training-agent router.approved, with a purchase token carryingiss= registered URL andaud=caller= seller.issand the revocation-list issuer match, with no trailing slash./mcpreturn 401.Existing suites: training-agent*,
server/src/training-agent, comply-test-controller, storyboard-runner-options, storyboard-fix-plan, the Addie web-tool tests and training-agent integration all pass. The Training agent rejects governance tokens in local multi-agent runs: issuer/audience are pinned to the production host #7742 tests and the labverify_governance_tokentest were updated for the new issuer.End-to-end diagnostic (local, not committed).
Setup:
media_buy_seller/governance_{approved,conditions,denied}routed as fix(compliance): route hosted multi_agent governance storyboards to the public governance agent #7779 does.salesgoes to a loopback HTTPS third-party seller. That seller is not the training agent's sales tenant: it enforces with the SDK'sverifyGovernanceAuthorization, usingexpectedIssuer= the registered URL, and runs an online execution check at the registered URL with the registered credential.governancegoes to the training agent's governance tenant.Results:
governance_approved13/13 andgovernance_conditions12/12 pass.governance_deniedfails only atcreate_media_buy_denied(fixture defect above).governance_token_not_applicable: Governance token caller mismatchnpx tsc --noEmit -p server/tsconfig.jsonpasses.No changeset: training agent and Addie only.
🤖 Generated with Claude Code