Repository navigation
docs(agent-identity): catch up the design with slice 3 and ToolHive v0.60.0 - #2657
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Allowing clock-skew tolerance between requested and echoed expires_at values can raise replacement caps and repeatedly extend a session, violating the stated no-extension requirement.
1 open issue
What changed in this PR
Updates the agent-identity design to reflect slice 3 decisions and ToolHive v0.60.0 capabilities. This is documentation-only; no runtime or wire behavior changes.
Changes:
- Records clock-skew handling, revocation during session-open conversion, and client error codes.
- Updates the ToolHive capability ledger and links remaining gaps.
- Replaces interim wording with final-state requirements and marks unresolved definition loading as open.
| File | Description |
|---|---|
| docs/drafts/agent-identity/README.md | Makes deployment-boundary wording conditional rather than time-specific. |
| docs/drafts/agent-identity/implementation.md | Updates verification requirements and ToolHive capability status. |
| docs/drafts/agent-identity/credentials-and-lifecycle.md | Revises token checks, expiry handling, revocation, and error mappings. |
| docs/drafts/agent-identity/audit.md | Clarifies audit requirements and the open definition-loading question. |
Review effort: Balanced
| `expires_in` is illustrative; the hard expiry is not selected. `RT-A42` is opaque to the broker. Its meaning lives in an AS-1 record, a [grant](#example-nomenclature), that binds it to client `mecatl` and to Alice as `u-alice-91`, with a hard expiry. Every ID-JAG issued from it names that subject. | ||
|
|
||
| The broker checks that the echoed entry has the type and `issuable_token_types` it sent, and an `expires_at` no later than the one it requested, if any; an echo without `expires_at` does not match. It then stores `RT-A42` under `A42` with the verified owner and the echoed expiry, in its shared session storage, so any replica can use it and run the [run-owner check](#6-per-operation-authorization) without asking AS-1. If the echo does not match, or the response cannot be decoded, the broker revokes `RT-A42` (RFC 7009, or in process while AS-1 is a broker module), which closes `A42`, and fails the open. The existing broker session record under `A42` keeps the workload and host-session binding; the human authority lives in `RT-A42`, not in a broker-local human record. | ||
| The broker checks that the echoed entry has the type and `issuable_token_types` it sent, and an `expires_at` no later than the one it requested, if any, allowing the clock skew; an echo without `expires_at` does not match. It then stores `RT-A42` under `A42` with the verified owner and the echoed expiry, in its shared session storage, so any replica can use it and run the [run-owner check](#6-per-operation-authorization) without asking AS-1. If the echo does not match, or the response cannot be decoded, the broker revokes `RT-A42` (RFC 7009, or in process while AS-1 is a broker module), which closes `A42`, and fails the open. The existing broker session record under `A42` keeps the workload and host-session binding; the human authority lives in `RT-A42`, not in a broker-local human record. |
There was a problem hiding this comment.
Agreed. Please drop "allowing the clock skew" here and keep step (6) check 2. See the review.
|
@jhrozek, while checking the phase 1 and phase 2 tickets against the design I found three places where the design disagrees with itself. These lines are not in this PR's diff. If you tell me which side is right, I'll fix them here or in a follow-up.
|
jhrozek
left a comment
There was a problem hiding this comment.
Thanks for the catch-up. The final-state wording is a good call, and I checked most of the claims against the code and the ToolHive release. These are right: the v0.60.0 contents (the grants stack except the Derive child exchange grants from refresh tokens PR), the identity_broker_session_refused code, the sign-in metadata member, the AS-1 rate limits in cmd/mecak8s/serve.go, and the work-list row that still tracks replay-revoke. Two things need changing, and two are small.
1. The echo check should not allow clock skew (line 309). I agree with Copilot's comment. The requested and echoed expires_at are absolute timestamps, and AS-1 echoes the smaller of the requested time and its cap, so a later echo cannot be legitimate. Allowing one lets each reopen extend the session by up to the skew, because the echo becomes the next cap. This also contradicts the Clock paragraph of "Register the broker client at AS-1 and point the broker at it" (#2607), which says the checks take no allowance because it "would only let the broker present a grant AS-1 may already have expired". Note that "Authorization server: allow clock skew on private_key_jwt client assertions" (toolhive#6954) is a different skew. It's about AS-1 accepting client assertions, and nothing tracks an allowance here. Keep the echo comparison exact. The new step (6) check 2 (line 496) is right and should stay: treating the stored expiry as expired one skew early fails closed.
2. The API-audience row should say "Partly", not "Yes from v0.60.0" (implementation.md line 142). "Configured delegate client with api_audience can exchange for API access tokens" (toolhive#7026) shows the broker can mint Mecatl API access tokens. The design requires that it never can. Please don't name api_audience in the row. The setting is being reworked on the ToolHive side, so say "the API audience setting".
3. The alg claim (line 197): "a fixed allowlist of asymmetric algorithms (RS, PS, and ES families)", citing #2497. I could not find that check in authn/oidc, the adapters or the broker. Which file has it?
4. Nit (audit.md line 27): "AuditEvent profile; These are listed in..." has a semicolon before a capital. Suggest: "...the AuditEvent profile. The ToolHive work list has the rows."
No change requested on the offline_access row. Linking toolhive#7029 is fine. The reason string it will return is not settled yet, and I'll follow up on that issue.
| | --- | --- | --- | --- | | ||
| | Exchange of a self-issued access token presented by another confidential client (the Mecatl-API-audience exception) | Mostly; the requested `aud` must be a subset of the subject token's `aud` | Small to medium | Identity work | | ||
| | Refresh token in a token-exchange response: a grant bound to the client and user, with an exchange-grant `authorization_details` entry that fixes its one output and its capped expiry, echoed with the granted expiry; one grant per source `jti` | No; exchange issues access tokens only; in progress ([#6897](https://github.com/stacklok/toolhive/issues/6897)) | Medium to large | Identity work | | ||
| | Exchange of a self-issued access token presented by another confidential client (the Mecatl-API-audience exception) | Yes from v0.60.0, for a configured delegate client with `api_audience`; but listing the API audience also lets the delegate exchange for API access tokens ([#7026](https://github.com/stacklok/toolhive/issues/7026)) | Small | Identity work | |
There was a problem hiding this comment.
"Partly", and refer to "the API audience setting" without the field name. See the review.
There was a problem hiding this comment.
Done: "Partly". The row now says "the API audience setting" instead of naming the field, and links toolhive#7026.
| **Checks, at mecak8s** (RFC 9068 §4): | ||
|
|
||
| 1. The header `typ` is `at+jwt` or `application/at+jwt`, and `alg` is on the configured allowlist, which excludes `none` and every symmetric algorithm. | ||
| 1. The header `typ` is `at+jwt` or `application/at+jwt`, and `alg` is on a fixed allowlist of asymmetric algorithms (RS, PS, and ES families), which excludes `none` and every symmetric algorithm. |
There was a problem hiding this comment.
Where is this allowlist enforced? I couldn't find it.
There was a problem hiding this comment.
It's enforced in toolhive-core rather than mecatl. The allowlist is authn/validate.go lines 105–107 in toolhive-core v0.0.58 (RS/PS/ES 256–512), and line 308 applies it again through jwt.WithValidMethods. mecak8s validates AS-1 tokens with authn.NewValidator (authn/oidc/oidc.go:158). I added "enforced by the token validator (toolhive-core authn)" to the line.
| | 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. | | ||
|
|
||
| AS-1 and AS-2 must produce the records above, following the [AuditEvent profile](#auditevent-profile); ToolHive's authorization server records no audit events today, so this is new work. | ||
| AS-1 and AS-2 must produce the records above, following the [AuditEvent profile](#auditevent-profile); These are listed in the [ToolHive work list](implementation.md#toolhive-work-list). |
There was a problem hiding this comment.
Suggest: "...following the AuditEvent profile. The ToolHive work list has the rows."
There was a problem hiding this comment.
Done, using your wording.
|
@ChrisJBurns, my answers, in order:
|
…0.60.0 Record the clock-skew rule for the echo and hard-expiry checks and the revoke on a session closed during conversion, remove interim wording, name the 403 client code, and refresh the ToolHive work list. Co-authored-by: Mecatl <[email protected]>
…face, and URL elicitation Co-authored-by: Mecatl <[email protected]>
… and link AS-2 reason codes Co-authored-by: Mecatl <[email protected]>
…status, design consistency Keep the echo comparison exact and the early hard-expiry check; mark the API-audience exchange as partly supported; say where the alg allowlist is enforced; resolve three contradictions the review settled. Co-authored-by: Mecatl <[email protected]>
1291ebe to
488c9b1
Compare
|
Thanks. All three are fixed in 488c9b1:
The branch is rebased onto #2653. |
jhrozek
left a comment
There was a problem hiding this comment.
Approving at 488c9b1. All four points from my earlier review are resolved:
- The echo check is exact, and step (6) check 2 keeps the skew margin on the hard expiry.
- The API-audience row says "Partly" and no longer names the setting.
- I checked the
algallowlist you cited: toolhive-core v0.0.58authn/validate.golines 105 to 107 and 308 match, and Mecatl pins that version. - The
audit.mdsentence is fixed.
Your three answers on the design are applied as agreed, and the checks are green.
One non-blocking follow-up: the Clock paragraph of "Register the broker client at AS-1 and point the broker at it" (#2607) says the hard-expiry check takes no clock-skew allowance. The design now treats the hard expiry as reached one skew early (which fails closed). Please align the ticket text: the echo is exact, and the hard expiry gets the early margin.
I still owe a follow-up on the offline_access reason string on toolhive#7029.

Brings the agent identity design up to date with work merged since the last catch-up. The design describes the final state, so this removes interim wording and leaves shortcuts to the tickets that remove them. It also records two decisions taken during the slice 3 audit.
Decisions recorded
credentials-and-lifecycle.mdstep (3) and step (6) check 2). The echo check allows the clock skew. The broker treats a refresh token as expired one skew before its hard expiry, so it never presents a token AS-1 considers expired. This holds whether or not the broker and AS-1 share a clock (Register the broker client at AS-1 and point the broker at it #2607).Final-state wording
README.md,implementation.md, the nomenclature table, andaudit.md. The undecided loading of non-global definitions inaudit.mdbecomes an Open. item.Matching what merged
algon AS-1 access tokens is a fixed asymmetric allowlist (RS, PS, ES), not a configured one (feat(authn): own sessions by the sign-in's sub_id identity #2497).owner_mismatch,session_owned) name the client codeidentity_broker_session_refused(feat(server): open the identity broker session before any change #2606).ToolHive work list
offline_accesscheck: linked to toolhive#7029.invalid_client(toolhive#7028).Merged behaviour now in the design
com.stacklok.mecatl.identity_broker_sign_in. Clients that see it send the RFC 8707resourceand refresh before each session open (feat(mecatui): sign in at AS-1 from the TUI #2572). This replaces "neither client changes".API compatibility
Design documentation only. No code, protobuf, or wire behaviour changes.