06

Run Authorization and Capability Tokens

Authorize one immutable deployment before execution, keep broad credentials out of the runtime, and issue short-lived proof for exactly one downstream action.

The enterprise problem and today’s slice

Enterprise problem: Starting an agent from a valid session and giving its runtime reusable connector tokens turns one stale membership, prompt injection, or compromised dependency into broad and persistent enterprise access.

Whole-course context: Day 01 produced durable agents, immutable version digests, team-specific deployments and capability bindings, public-safe visibility, and release evidence; today consumes those exact IDs and snapshots at run admission.

Today’s slice: We authorize a run, issue audience-bound admission and delegation tokens, require workload identity as a second key, broker one action-bound capability token, and bound revocation freshness across provider, hosted-runtime, and connector boundaries.

End-of-day evidence: A reviewer receives an allowed run, a denied cross-team run, a two-key runtime proof, a single-use capability replay denial, and a mid-run revocation result with complete actor/resource/scope/precondition/observed evidence.

Still unsolved: Connector discovery, detailed tool and argument policy, human approval, Model Context Protocol (MCP) mediation, agent-to-agent delegation, source data trimming, and production infrastructure are deliberately deferred.

Customer use cases

If a run starts before the platform checks current user, team, deployment, version, and risk state, expensive execution begins with ambiguous authority and later services cannot tell what was actually admitted.

Use case IDActorCustomer jobSuccess outcomeDenial or recovery evidence
D06-UC-01Team agent operatorStart one approved deployment under one explicit teamControl plane evaluates current organization, user, membership, agent.run, deployment, immutable version, model availability, and risk policy before allocating runtimeCross-team, inactive, unapproved, unavailable-model, or missing-permission requests deny before runtime allocation and retain a decision ID
D06-UC-02Runtime security operatorAdmit only the intended workload carrying the intended human delegationRuntime entry requires both an attested workload identity and short-lived run authority bound to organization, team, subject, version, deployment, run, membership version, issuer, and audienceStolen run authority from an untrusted workload and trusted workload without valid delegation both deny; no connector credential reaches runtime
D06-UC-03Agent runner and connector adapterExecute one already-authorized action without giving the model reusable authorityTool gateway mints an audience-, tool-, resource-, argument-, decision-, and lifetime-bound capability token; adapter verifies it before retrieving external credentialChanged arguments, wrong adapter, expired token, replay, foreign connector, or undeclared tool denies while a fresh valid action remains allowed
D06-UC-04Security administratorRevoke user, deployment, connector, tool, or approval during a long runLow-risk reads use bounded freshness; high-risk writes revalidate immediately; revocation event cancels or blocks the next privileged actionPost-revocation action denies within objective, caches show invalidation, and an unrelated subject or deployment remains a positive control

Run admission uses an intersection:

CanRunAgent(user, team, deployment) =
    organization is active
  AND user is active
  AND user belongs to organization
  AND current user membership includes selected team
  AND deployment targets selected team
  AND deployment is active
  AND user has agent.run for this agent
  AND immutable version is approved
  AND required model is available to this team
  AND session and risk policy permit this run

The result is not general tool authority. It means only that this subject may execute this immutable deployment under this team for a bounded period.

Actor-centred user stories

When an “allowed” result omits the facts and version that produced it, operators cannot reproduce a decision or know when it became stale, so incident response degenerates into guesswork.

Story IDUse case IDsUser storyObservable acceptance conditions
D06-US-01D06-UC-01As a team agent operator, I want run permission checked before runtime allocation, so that a denied request incurs no model cost and cannot enter another team's deploymentMarketing member starts Marketing v17; the same user targeting Finance receives deployment_not_available_to_team; evidence names membership, grant, policy, model, deployment, and decision revisions
D06-US-02D06-UC-02As a runtime security operator, I want workload identity and human delegation checked as two independent keys, so that stealing either one is insufficientAttested runtime plus current run delegation admits; token from an untrusted workload denies; trusted workload without delegation denies; runtime secret inventory contains no downstream credential
D06-US-03D06-UC-03As a responsible agent runner, I want each approved side effect represented by a single-use capability token, so that a model or compromised runtime cannot widen or replay itAdapter accepts exact Slack channel and argument digest once; changed channel, changed body, wrong adapter, and second presentation deny with distinct decision reasons
D06-US-04D06-UC-04As a security administrator, I want revocation to interrupt long-running authority, so that removing membership or disabling a deployment is effective before the next consequential actionRevocation increments version, publishes event, evicts cache, cancels eligible runs, and makes the next high-risk write deny while independent positive control stays healthy

The runtime should hold only a short-lived run context, immutable workflow, approved visible tool catalogue, and workload credential used for mutual authentication. It must not hold every team's API keys, connector refresh tokens, or permission to choose any tool.

Agent runtime
  run-scoped delegation
  immutable workflow
  filtered tool catalogue
  no downstream credentials

Tool gateway
  current authorization facts
  credential broker interface
  argument and risk policy
  approval state
  immutable audit writer

A model output is an untrusted proposal:

{
  "tool": "slack.post_message",
  "arguments": {
    "channel_id": "C_CAMPAIGN_OPS",
    "text": "The autumn campaign draft is ready for review."
  }
}

It has no authority until an independent policy decision binds that exact operation and canonicalized argument digest.

End-to-end product flows

Bearer tokens become confused deputies when they are reusable across services or operations, so each flow narrows audience and purpose as authority moves closer to the side effect.

Flow IDUse case IDsPathTriggerNumbered stepsTerminal evidence
D06-FLOW-01D06-UC-01HappyMarketing operator clicks “Run” on deploy_marketing_prod1. Submit selected team, deployment, and input.<br>2. Resolve active organization and user.<br>3. Load current team membership and explicit agent.run grant.<br>4. Verify deployment targets team, version approval, model availability, session strength, and risk policy.<br>5. Persist decision and allocate run only after allow.Evidence records operator, deployment resource, agent.run scope, all fact preconditions, expected admission, observed run ID, environment, timestamp, policy and membership versions, version digest, and immutable decision ID
D06-FLOW-02D06-UC-02DeniedA copied run-admission token is presented by an untrusted workload1. Validate issuer, signature, audience, expiry, subject, team, deployment, version, run, and decision.<br>2. Verify runtime workload attestation and service audience.<br>3. Compare workload to deployment environment.<br>4. Deny on mismatch before execution.<br>5. Admit the intended workload with a fresh token as positive control.Evidence records presenting workload, run resource, delegation scope, precondition token copied, expected deny, observed workload_binding_mismatch, positive-control result, environment, timestamp, attestation ID, and immutable runtime-admission decision ID
D06-FLOW-03D06-UC-03DeniedRuntime proposes an approved Slack post, then replays its capability token with a changed channel1. Send proposal plus run delegation over mutually authenticated channel.<br>2. Gateway revalidates current run, deployment, tool, connector, argument, risk, and approval facts.<br>3. Canonicalize arguments and persist tool decision.<br>4. Mint single-use capability for exact adapter, connector, resource, and digest.<br>5. Adapter accepts original once, then rejects changed-channel replay.<br>6. Fresh allowed action succeeds as positive control.Evidence records initiating user and acting agent, Slack channel resource, slack.post_message scope, original and changed argument digests, expected one allow then replay deny, observed provider request IDs, environment, timestamp, tool decision, and immutable trace ID
D06-FLOW-04D06-UC-04RecoveryAdministrator removes the operator from Marketing during a long run1. Membership Service increments version and records revoke.<br>2. Revocation stream evicts authorization caches and signals active runs.<br>3. Runtime reaches next high-risk action.<br>4. Gateway reloads current membership and denies.<br>5. Cancel run or continue only non-privileged cleanup by policy.<br>6. Probe an unaffected operator as positive control.Evidence records administrator and revoked subject, membership and pending-action resources, scopes, precondition run active, expected privileged deny, observed cancellation or bounded cleanup, unaffected result, environment, timestamp, revocation-event and run IDs

Audience separation prevents token reuse. One secure pattern is:

  1. Control plane issues a one-time runtime-admission token with audience agent-runtime.
  2. The attested runtime exchanges it for a run delegation with audience tool-gateway and no direct downstream scope.
  3. After a per-action allow, the gateway issues a capability with audience connector-adapter:slack.
  4. The adapter verifies token and workload channel, consumes nonce once, then obtains the real external credential through the broker.

An illustrative run delegation carries bounded context:

{
  "iss": "https://authorization.platform.example",
  "aud": "tool-gateway",
  "sub": "user_8472",
  "org": "org_acme",
  "team": "team_marketing",
  "agent_id": "agent_campaign_launch",
  "agent_version": "version_17",
  "deployment_id": "deploy_marketing_prod",
  "run_id": "run_01K1HZH8",
  "membership_version": 39182,
  "decision_id": "decision_run_f781",
  "iat": 1785527300,
  "exp": 1785527600
}

The per-action capability is narrower:

{
  "iss": "https://authorization.platform.example",
  "aud": "connector-adapter:slack",
  "sub": "user_8472",
  "act": {"sub": "agent_campaign_launch", "version": "17"},
  "org": "org_acme",
  "team": "team_marketing",
  "connector_instance": "connector_slack_marketing",
  "tool": "slack.post_message",
  "resource_constraints": {"channel_id": "C_CAMPAIGN_OPS"},
  "argument_digest": "sha256:7814...",
  "nonce": "cap_nonce_4d91",
  "single_use": true,
  "decision_id": "decision_tool_91d8",
  "iat": 1785527390,
  "exp": 1785527450
}

System design derived from the flows

A runtime that can read the credential vault or mint its own capabilities can bypass every higher-level policy, so token creation, credential retrieval, and execution must reside in separately authenticated services.

Use case IDEntry pointResponsible servicesAuthoritative storeFailure evidence
D06-UC-01POST /agent-runs from selected deployment pageRun Authorization Service loads current subject and membership; Grant Service checks agent.run; Deployment and Version Services validate target and digest; Model and Risk Policy Services evaluate availabilityRun Decision Store owned by Authorization Service; current facts stay authoritative in Membership, Grant, Deployment, Version, Model Policy, and Risk Policy storesorganization_inactive, subject_inactive, not_current_team_member, missing_agent_run_permission, deployment_not_available_to_team, version_unapproved, or model_not_available, with decision ID
D06-UC-02Runtime admission and delegation exchangeToken Service signs audience-bound admission; Workload Identity Service verifies attestation; Runtime Admission Service checks deployment/environment binding; Delegation Service issues tool-gateway audienceWorkload Trust Store owned by Runtime Identity; token signing keys owned by Authorization Service; Run Store owned by Run Orchestratorinvalid_token_audience, untrusted_workload, workload_binding_mismatch, admission_replayed, or run_not_active, with attestation and admission decision IDs
D06-UC-03Tool Gateway action-intent endpoint and connector adapterTool Gateway loads current run and action facts; Argument Canonicalizer computes digest; Capability Issuer signs narrow token; Adapter Verifier consumes nonce; Credential Broker alone retrieves downstream credentialTool Decision and Capability Consumption stores owned by Tool Gateway; secret material owned by Vault; downstream provider owns final resource ACL and request logtool_not_declared, argument_outside_scope, wrong_capability_audience, argument_digest_mismatch, capability_replayed, or downstream deny, with tool decision and provider request IDs
D06-UC-04Membership/deployment/connector administration and revocation streamOwning service increments resource version; Revocation Bus publishes event; Cache Coordinator invalidates facts; Run Supervisor cancels or flags active run; Tool Gateway revalidates consequential actionSource grant store owned by revoking service; Revocation Event Store owned by Security Operations; Run State Store owned by Run Orchestratorauthorization_stale, membership_revoked, deployment_disabled, connector_revoked, approval_withdrawn, or missed freshness objective, with event and run IDs

The two-key rule requires both valid workload identity and valid delegated run authority. Workload identity proves which hosted service is calling; run delegation proves which current user, team, agent, version, deployment, and run authorized the work. Neither key grants access alone.

Revocation freshness depends on risk. Low-risk reads may use a short token and bounded, versioned cache. High-risk writes reload current membership, deployment, connector, approval, and downstream token immediately before execution. The product states measurable objectives for propagation and records when they are missed.

Data model and ownership

If token claims are the only durable record, expiry erases the reason an action was allowed and revocation cannot find active authority, leaving the customer unable to investigate or contain a run.

Generated-application database: Not created in this slice — run admission, workload binding, capability consumption, revocation, and evidence are durable provider/runtime records; generated-app tenants and domain authorization remain owned by the application introduced in Day 02.

Record or entityStore and ownerPrimary keyForeign key or opaque referenceTenant keyMaterial constraintLifecycle and deletionUse case IDs
RunAuthorizationDecisionRun Decision Store; Authorization Servicerun_decision_idOpaque references to session, subject, membership version, agent grant, deployment, version digest, model policy, and risk policyorganization_idImmutable full conjunct result; allow is bound to one selected team and deployment; deny also persistedCreated before allocation; sealed; retained by audit policy; archived or deleted after legal-hold checksD06-UC-01
AgentRunRun State Store; Run Orchestratorrun_idOpaque references to RunAuthorizationDecision, deployment, version, runtime environment, and initiating subjectorganization_id plus team_idState machine prevents execution before allow; exact version and deployment immutable for runAdmitted, running, cancelling, completed, failed, or revoked; payload deleted by data policy while minimal evidence remainsD06-UC-01, D06-UC-02, D06-UC-04
WorkloadAttestationWorkload Trust Store; Runtime Identity Serviceattestation_idOpaque workload, deployment, environment, issuer, and key referencesorganization_idShort-lived, issuer- and audience-validated, bound to approved workload; never substitutes for human delegationIssued and rotated automatically; expires quickly; security metadata retained with run evidenceD06-UC-02
TokenGrantToken Metadata Store; Authorization Servicetoken_grant_idOpaque references to run decision, run, workload attestation, signing-key version, and parent grantorganization_id plus team_idAudience and purpose can only narrow across exchange; expiry cannot exceed parent; token value is never storedMetadata created on mint; token expires quickly; grant revoked with parent; metadata retained for traceabilityD06-UC-02, D06-UC-03
ToolDecisionTool Decision Store; Tool Gatewaytool_decision_idOpaque references to run, deployment binding, connector, tool policy, approval, credential binding, and downstream principalorganization_id plus team_idExact canonical arguments and digest, resource constraints, actor and agent, expected outcome, and policy revisions immutableCreated for allow and deny; sealed before capability mint; retained with provider request trace, then archivedD06-UC-03, D06-UC-04
CapabilityGrantCapability Store; Tool Gatewaycapability_grant_idLocal ToolDecision reference; opaque adapter, connector, resource, nonce, and signing-key referencesorganization_id plus team_idAudience-, operation-, resource-, argument-, decision-, lifetime-bound; optionally single-use; never broader than decisionMinted only after allow; expires in seconds; revoked with parent; metadata retained through audit windowD06-UC-03
CapabilityConsumptionCapability Store; Adapter Verifiercapability_nonceLocal CapabilityGrant reference; opaque workload attestation and downstream request referencesorganization_id plus team_idAtomic first-consumer wins; digest and audience must match; replay records deny without repeating side effectCreated on first presentation; immutable; retained for replay investigation; archived or deleted under policyD06-UC-03
RevocationEventAppend-only Revocation Store; Security Operationsrevocation_event_idOpaque target reference to membership, grant, deployment, connector, tool, approval, token grant, or runorganization_id plus optional team_idMonotonic target version, idempotency key, occurred time, received time, and propagation status mandatoryAppended by owner action; never rewritten; retained to prove freshness objective; later archived or deletedD06-UC-04
RunAndCapabilityEvidenceAppend-only Audit Store; Audit Serviceevidence_idOpaque references to run, decisions, token grants, attestations, capability consumption, revocation, and provider requestorganization_id plus team_idActor, resource, scope, precondition, expected, observed, environment, timestamp, and immutable identifiers mandatoryAppended throughout run; sealed at terminal state; exportable; legal-hold aware retention and deletionD06-UC-01, D06-UC-02, D06-UC-03, D06-UC-04

The retention split is deliberate: secret token values disappear at expiry, while hashes, nonces, policy versions, subject/resource references, and observed outcomes remain long enough to prove what happened. Retaining the bearer credential itself would enlarge breach impact without improving audit.