Repository navigation
Closed
Labels
auditauthenticationauthorizationenhancementNew feature or requestgoPull requests that update go code
Description
Summary
ToolHive's embedded authorization server already mints delegated JWTs with the RFC 8693 act claim and supports nested act for multi-level delegation (pkg/authserver/server/tokenexchange/handler.go). However, when those tokens are presented to the proxy / vMCP request-serving path, the audit log events do not capture the actor identity or the delegation chain at all. The audit event only records the terminal sub (the original user), making it impossible to distinguish "Alice did X" from "Alice's coding agent did X on Alice's behalf" — the exact forensic gap RFC 8693 is designed to close.
Current state
- Issuance side:
actis minted and nested up tomaxDelegationDepth = 10(pkg/authserver/server/tokenexchange/handler.go:31,155-163).may_actis parsed intoMayActClaim;actis stored inValidatedClaims.Extra(validator.go:284-286). - Request-serving side:
claimsToIdentity(pkg/auth/context.go:175) extracts onlysub,name,emailinto structured fields.actsurvives only as an opaque entry inIdentity.Claims. - Audit side:
extractSubjectsFromIdentity(pkg/audit/auditor.go:516) andWorkflowAuditor.extractSubjects(pkg/audit/workflow_auditor.go:396) read only flat string claims intoSubjects map[string]string. There is no handling ofact,actor, ordelegationanywhere inpkg/audit/orpkg/auth/. - Authorization side: Cedar's entity converter surfaces
actgenerically asclaim_actwith a depth cap of 10 (pkg/authz/authorizers/cedar/entity.go:18), but that is authz evaluation, not audit.
Gap
- No
actextraction on the request-serving path —claimsToIdentitydoes not promoteactto a structured field. - Audit cannot represent a delegation chain —
Subjectsismap[string]string(pkg/audit/event.go:66), structurally flat. - No depth / truncation policy in audit — if
actwere naively surfaced, arbitrary nesting would be unbounded. - No tests for
actin audit —TestExtractSubjectscovers flat claims only. - No shared
acttype — issuance and audit each handleactad-hoc (map[string]any).
Proposed solution
- Add a first-class
ActorClaim/DelegationChaintype inpkg/auth(orpkg/audit) that:- Parses the nested
actclaim from JWT claims. - Supports arbitrary depth (bounded by a configurable cap, default aligned with the existing
maxDelegationDepth = 10). - Preserves ordering: outermost = current actor, innermost = original delegator.
- Parses the nested
- Promote
actintoIdentity/PrincipalInfoduringclaimsToIdentity. - Extend
AuditEventto carry the delegation chain in a structured, machine-readable form (e.g.DelegationChain []ActorInfoin metadata or a dedicated field), while keeping the existingSubjectsmap for backward compatibility. - Update both HTTP
AuditorandWorkflowAuditorto populate the delegation chain. - Add tests: unit tests for
ActorClaimparsing, audit extraction tests with nestedact, and an integration test that mints a delegated token, presents it through the middleware chain, and asserts the audit event contains the actor and chain.
Acceptance criteria
- A delegated token's
act.subappears in every audit event for requests it authorizes. - The full delegation chain (all nested
actentries) is preserved in audit events in chronological order (original delegator first, current actor last). - Depth is capped and truncation is explicit (e.g.
truncated: trueflag) rather than silent. - Existing flat
Subjectskeys remain unchanged for backward compatibility. - Tests cover issuance → validation → audit extraction end-to-end.
References
- RFC 8693 §4.1 — Actor claim semantics and nested
actfor delegation chains. - RFC 9700 (BCP 240) — OAuth 2.0 Security Best Current Practice.
- Issue Embedded auth server should support RFC 8693 token exchange so agents can act on behalf of users #5194 — Embedded auth server RFC 8693 token exchange (issuance side, already implemented).
pkg/audit/auditor.go:516— current subject extraction.pkg/authserver/server/tokenexchange/handler.go:155— currentactminting.
Metadata
Metadata
Assignees
Labels
auditauthenticationauthorizationenhancementNew feature or requestgoPull requests that update go code
Activity
jhrozek commentedon Jul 27, 2026
thanks, I added the issue to the delegation epic
Regenerate operator CRDs and CRD docs for maxDelegationDepth
Capture RFC 8693 act claim in audit logs (#6035)
Regenerate operator CRDs and CRD docs for maxDelegationDepth
Capture RFC 8693 act claim in audit logs (#6046)
Adopt toolhive-core canonical delegation-chain schema (#6107)
solara-associates commentedon Oct 8, 2026
On the ordering ambiguity: the acceptance criteria (original delegator first, current actor last) seems the safer choice for audit. It reads the way the authority actually flowed, it matches how chains are verified (from the root down), and a truncated chain then keeps the delegator, which is usually the field an auditor needs most. With truncation, recording which end was cut would help too.
One thing worth noting in the design: nested act claims record what the token issuer asserted about the chain. No individual hop signed anything, so the audit log can show who claimed to act, but not prove that each hop held the authority it passed on, or that it was not revoked when used.
For deployments that need that, we published a draft A2A extension where each hop carries an independently signed, attenuating delegation proof (VAID), with test vectors and a small Python verifier: https://github.com/solara-associates/vaid/blob/main/docs/a2a/v1/extension.md
Not suggesting ToolHive change course here. Recording act claims is the right first step. But if a verified-chain field is ever useful alongside DelegationChain, a VAID chain maps onto ActorInfo cleanly and we would be happy to contribute that.