Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/drafts/agent-identity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The alternative, giving the agent the user's provider token, would undo the othe

The agent host still has to send calls to the gateway, so it needs some token. If that token allowed any call, the agent host could ask the broker to approve a harmless call and then use the token for a different one, and the broker's check would mean nothing.

So the agent host asks the broker before every protected call, and the broker returns a token only for the call it approved: this tool, with these arguments, once. The gateway refuses the token for anything else. A refused call gets no token and never reaches the provider. A token taken from the agent host is good for one call that was already approved, and only briefly.
So the agent host asks the broker before every protected call, and the broker returns a token only for the call it approved: this tool, with these arguments, once. The gateway refuses the token for anything else, and for a second use of it, because it records each token it has accepted. A refused call gets no token and never reaches the provider. A token taken from the agent host is good for one call that was already approved, and only briefly.

### The broker ties each agent to its session

Expand Down Expand Up @@ -201,7 +201,7 @@ Alice asks her main agent to list pull requests and review PR 42. The main agent

**Sign-in and session open.** Alice signs in at AS-1, which redirects her to the company IdP, and her client calls mecak8s with the AS-1 access token. Sign-in happens at AS-1 rather than in mecak8s so that Mecatl cannot invent a user: mecak8s checks that Alice owns the session and forwards the token to the broker once, and the broker exchanges it at AS-1 for a refresh token, which the broker holds for that broker session. Every later grant names the user from AS-1's record of that refresh token, never from anything mecak8s sends with a call. The broker holds the refresh token because agents keep working after Alice closes her client. It carries her authority for that one session, has a hard expiry, and is revoked when the session closes or she signs out everywhere. The broker is one OAuth client, `mecatl`, at both AS-1 and AS-2, so a leaked refresh token is useless without the broker's key.

**Each call.** mecak8s's MCP client asks the broker to authorize the call, naming the server, the tool, and a hash of the arguments. The broker sends the refresh token and the acting agent's JWT-SVID to AS-1. The broker has already checked that the agent is registered to the session. AS-1 checks that the agent's session belongs to the refresh token's user and that the combination of client, user, agent, and gateway is allowed, then returns an ID-JAG naming Alice and the agent in its `act` claim. The JWT-SVID gives the gateway and the audit trail the acting agent; it asserts that agent rather than authenticating it, because agents share one process. The broker redeems the ID-JAG at AS-2 for the vMCP access token `V`, bound to that one call and usable once, and returns it to the MCP client, which sends the call and discards `V`. AS-2 maps AS-1's user to its own account for Alice and never receives her AS-1 token or the agent's JWT-SVID. An external gateway also requires a one-time consent link, which Alice creates at AS-2's own login. The link is her own statement, made at the gateway, that Mecatl may act for her, so a compromised AS-1 cannot use the gateway credentials of a user who never chose Mecatl.
**Each call.** mecak8s's MCP client asks the broker to authorize the call, naming the server, the tool, and a hash of the arguments. The broker sends the refresh token, the acting agent's JWT-SVID, and an entry naming the call (the server, tool, argument hash, and operation ID) to AS-1. The broker has already checked that the agent is registered to the session. AS-1 checks that the agent's session belongs to the refresh token's user and that the combination of client, user, agent, and gateway is allowed, then returns an ID-JAG naming Alice and the agent in its `act` claim, and an `authorization_details` claim holding the call entry that AS-1 signs. The JWT-SVID gives the gateway and the audit trail the acting agent; it asserts that agent rather than authenticating it, because agents share one process. The broker redeems the ID-JAG at AS-2 for the vMCP access token `V`, bound to that one call and usable once. It checks that `V` carries the entry it sent, then returns `V` to the MCP client, which sends the call and discards `V`. AS-2 maps AS-1's user to its own account for Alice and never receives her AS-1 token or the agent's JWT-SVID. An external gateway also requires a one-time consent link, which Alice creates at AS-2's own login. The link is her own statement, made at the gateway, that Mecatl may act for her, so a compromised AS-1 cannot use the gateway credentials of a user who never chose Mecatl.

**The checks.** The broker checks the session, the workload, that the acting instance is registered to the session, the run and its owner, and the route. It also uses Cedar, a policy engine, to check the reviewer's effective ceiling: the reviewer's definition ceiling, narrowed by the main agent's. The design does not evaluate PR-specific bounds or comprehensive enterprise user policy. AS-2 redeems only for a mapped user, and in external mode only for a linked one, and the vMCP dispatches only with Alice's stored GitHub credential, which never reaches the harness or the model. If any check denies the call, no request reaches GitHub. Missing, stale, or revoked identity, consent, connection, or authorization evidence fails closed, with no fallback to a service credential, another user, or a more privileged agent.

Expand Down
11 changes: 6 additions & 5 deletions docs/drafts/agent-identity/audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Records must distinguish verified facts from trusted reports. Qualify subjects b
| Session authority | AS-1 records the one-time conversion at `OpenSession`: client `mecatl` authenticated with `private_key_jwt`, user, source access-token `jti`, and hard expiry. The broker records the open: broker session, the owner match, and the same `jti` | Shows that the broker held a valid AS-1 token for that user when the session opened. The session reference is broker-asserted. The conversion does not show that the user approved any later call. |
| Run and execution-delegation links | mecak8s reports them in the workload-authenticated call request as part of the [execution context](mcp-authorization.md#authentication-and-execution-context) | Correlation is not proof that the broker enforced delegated resource bounds. Creation ancestry is separate. The delegation lives in Mecatl's harness and broker records only; the ID-JAG and `V` name the current actor, not the instance that delegated the task. |
| Ceiling evaluation and broker decision | Broker's evaluation of the registered actor's exact server/tool ceiling and route, together with its session, workload, actor, and run-owner checks | A Cedar permit does not establish user entitlement or connection authority; AS-2 and vMCP enforce those. An allow proves neither dispatch nor downstream success. |
| ID-JAG issuance | AS-1 records each issuance: user from the broker refresh token's grant record, validated actor, target AS-2, and ID-JAG `jti`. AS-1 validated the SVID and checked that the instance's session belongs to that user. The broker records the same `jti` with the session, run, and instance. | AS-1 does not see the user again per call; the user comes from the grant record. Instance membership comes from the broker registry, and only the broker knows the session. |
| AS-2 redemption and consent | AS-2 records each redemption or denial: ID-JAG `jti`, client `mecatl`, native user, actor, resource, and decision. In external mode, AS-2 also records creation and revocation of the consent link. | AS-2 trusts AS-1's signature and receives neither the AS-1 access token nor the SVID. In external mode the consent link is AS-2's own evidence that the user chose Mecatl; in embedded mode consent is implicit. |
| ID-JAG issuance | AS-1 records each issuance: user from the broker refresh token's grant record, validated actor, target AS-2, ID-JAG `(iss, jti)`, and the call entry it signed. AS-1 validated the SVID and checked that the instance's session belongs to that user. The broker records the same `jti` with the session, run, and instance. | AS-1 does not see the user again per call; the user comes from the grant record. Instance membership comes from the broker registry, and only the broker knows the session. |
| AS-2 redemption and consent | AS-2 records each redemption or denial: ID-JAG `(iss, jti)`, client `mecatl`, native user, actor, resource, and decision. In external mode, AS-2 also records creation and revocation of the consent link. | AS-2 trusts AS-1's signature and receives neither the AS-1 access token nor the SVID. In external mode the consent link is AS-2's own evidence that the user chose Mecatl; in embedded mode consent is implicit. |
| vMCP decision | vMCP records its decision with the access-token reference `(iss, jti)`, native user, actor, tool, outcome, and the propagated operation ID | The gateway sees only the current actor in `act.sub`, not who delegated the task. The operation ID is reported, unverified trace context, as is other forwarded context unless independently verified. |
| Observed result and provider correlation | The response received by the recording component and safe provider references, when available | A broker-observed MCP response is not independent proof of provider-side effects. |

Expand All @@ -41,7 +41,7 @@ Every component records evidence as a [toolhive-core](https://github.com/stacklo
| Where it was recorded | `Component`, `Metadata.Extra` | `mecatl-broker`, `mecatl-as1`, or the ToolHive component name, plus the recording replica and deployment; components with a SPIFFE identity also record its trust domain. |
| Operation and target | `Target` | toolhive-core's keys: `type=tool`, `name`, `method=tools/call`, and the MCP server. For token-endpoint events, the requested audience and resource. Request metadata appears only if allowlisted for that type. |
| When | `LoggedAt`, `Metadata.Extra` | `LoggedAt` is the recorder's clock when it created the record, in UTC; a re-send keeps it. `mecatl.occurred_at` (RFC 3339 with offset) and `mecatl.clock` record when the event happened and whose clock said so. Events from different components are ordered by attempt and a per-component sequence number, never by timestamp alone. |
| Correlation | `Metadata.Extra` | `mecatl.operation_id` and `mecatl.attempt_id`. A retry is a new attempt. A result that arrives after an `unknown` outcome is a new event that references the earlier one; records are never edited. The broker passes the operation and attempt IDs to AS-1 and the vMCP, which record them as reported. |
| Correlation | `Metadata.Extra` | `mecatl.operation_id` and `mecatl.attempt_id`. A retry is a new attempt. A result that arrives after an `unknown` outcome is a new event that references the earlier one; records are never edited. The broker passes the operation ID to AS-1 inside the call entry, and the operation and attempt IDs to the vMCP, which records them as reported. |
| Evidence references | `Data` | Built from a typed structure per event type. Credential references are `(iss, jti)` or `(authorization server, record ID)`, never values. Definition revision and provenance. When `V` is a JWT, the broker's decision event records its `(iss, jti)`, read without verification and never used to authorize; otherwise it references AS-2's redemption event. |
| OAuth actor history | `DelegationChain` | Only an `act` chain the recorder validated in a token: AS-2 and the vMCP fill it, and broker events leave it empty. |
| Creation and delegation | `Data.lineage` | The run, plus references: the `AuditID` of the delegation event the call runs under and of the acting instance's registration event. The [lineage](#lineage) events hold the relationships, marked as reported by mecak8s. They are never derived from the SPIFFE path or from `act`. |
Expand Down Expand Up @@ -78,7 +78,7 @@ These records have limits:

- They are unsigned, so they do not provide non-repudiation.
- In external mode, AS-2 and vMCP records belong to the gateway operator; the Mecatl-side trail ends at the broker's dispatch event.
- An external gateway may allow an ID-JAG to be re-submitted until it expires, as ID-JAG §4.4.4 permits, so one ID-JAG can lead to several redemption events there, all linked by its `jti`. The embedded gateway accepts each ID-JAG once. In external mode, AS-2 records which approval record authorized each redemption.
- An external gateway may allow an ID-JAG to be re-submitted until it expires, as ID-JAG §4.4.4 permits, so one ID-JAG can lead to several redemption events there, all linked by its `(iss, jti)`. The embedded gateway accepts each ID-JAG once. In external mode, AS-2 records which approval record authorized each redemption.
- Reaching one operation from a gateway record depends on the propagated operation ID, which vMCP records as reported, not verified.

### Lineage
Expand All @@ -100,7 +100,7 @@ The broker records its authorization decision. mecak8s's MCP client, which sends

Decision, dispatch, and observed-outcome evidence must survive broker restart; [delivery, protection, and reconciliation](#delivery-protection-and-reconciliation) sets the write order and what happens when evidence cannot be delivered. This design does not claim atomicity between an audit write and an external effect.

Use operation and attempt references to connect the evidence; individual events also need their own references. The operation ID, the ID-JAG `jti`, and the AS-2 access token `(iss, jti)` are separate references. Each access token is bound to one call and names its operation ID in its `authorization_details`, so a gateway record leads to one operation through the token AS-2 signed. mecak8s also propagates the operation ID with each MCP request, and vMCP records it as reported, unverified trace context that must match the token. The broker sends the IDs as request parameters at AS-1, and mecak8s sends them in each MCP request's `_meta`; that propagation is not an authenticated contract. Because `act` names only the current actor, this operation ID is what keeps delegation `D42` reachable from a gateway log.
Use operation and attempt references to connect the evidence; individual events also need their own references. The operation ID, the ID-JAG `(iss, jti)`, and the AS-2 access token `(iss, jti)` are separate references. Each access token is bound to one call and names its operation ID in its `authorization_details`. AS-1 signed that entry into the ID-JAG, so a gateway record leads to one operation through the entry that AS-1 and AS-2 signed. The broker records the result of its output check, which compares the token's entry with the one it sent. mecak8s also propagates the operation ID with each MCP request, and vMCP records it as reported, unverified trace context that must match the token. The broker sends the operation ID to AS-1 only inside the call entry. mecak8s sends them in each MCP request's `_meta`; that propagation is not an authenticated contract. Because `act` names only the current actor, this operation ID is what keeps delegation `D42` reachable from a gateway log.

## Delivery, protection, and reconciliation

Expand Down Expand Up @@ -131,6 +131,7 @@ Correctly shaped records are not enough if they can be lost, rewritten, or never
| Mismatch | What it can mean |
| --- | --- |
| An AS-2 redemption with no matching AS-1 ID-JAG issuance | An ID-JAG minted outside the recorded path |
| An AS-1 ID-JAG issuance with no broker record for its `(iss, jti)` | A response lost after AS-1 issued the ID-JAG; the signed call entry still names the operation |
| A vMCP tool call with no matching broker decision for the same token `jti` and operation | An access token used outside the broker |
| A reported dispatch with no matching vMCP tool call, or a vMCP tool call with no reported dispatch | A record suppressed or misreported on one side |
| A session-open conversion whose source token has no AS-1 issuance and sign-in | A user token minted outside the recorded path |
Expand Down
Loading
Loading