Skip to content

Audit logs must capture RFC 8693 act (actor) claim and full delegation chain #6035

Closed

Description

@JAORMX

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: act is minted and nested up to maxDelegationDepth = 10 (pkg/authserver/server/tokenexchange/handler.go:31,155-163). may_act is parsed into MayActClaim; act is stored in ValidatedClaims.Extra (validator.go:284-286).
  • Request-serving side: claimsToIdentity (pkg/auth/context.go:175) extracts only sub, name, email into structured fields. act survives only as an opaque entry in Identity.Claims.
  • Audit side: extractSubjectsFromIdentity (pkg/audit/auditor.go:516) and WorkflowAuditor.extractSubjects (pkg/audit/workflow_auditor.go:396) read only flat string claims into Subjects map[string]string. There is no handling of act, actor, or delegation anywhere in pkg/audit/ or pkg/auth/.
  • Authorization side: Cedar's entity converter surfaces act generically as claim_act with a depth cap of 10 (pkg/authz/authorizers/cedar/entity.go:18), but that is authz evaluation, not audit.

Gap

  1. No act extraction on the request-serving path — claimsToIdentity does not promote act to a structured field.
  2. Audit cannot represent a delegation chain — Subjects is map[string]string (pkg/audit/event.go:66), structurally flat.
  3. No depth / truncation policy in audit — if act were naively surfaced, arbitrary nesting would be unbounded.
  4. No tests for act in audit — TestExtractSubjects covers flat claims only.
  5. No shared act type — issuance and audit each handle act ad-hoc (map[string]any).

Proposed solution

  1. Add a first-class ActorClaim / DelegationChain type in pkg/auth (or pkg/audit) that:
    • Parses the nested act claim 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.
  2. Promote act into Identity / PrincipalInfo during claimsToIdentity.
  3. Extend AuditEvent to carry the delegation chain in a structured, machine-readable form (e.g. DelegationChain []ActorInfo in metadata or a dedicated field), while keeping the existing Subjects map for backward compatibility.
  4. Update both HTTP Auditor and WorkflowAuditor to populate the delegation chain.
  5. Add tests: unit tests for ActorClaim parsing, audit extraction tests with nested act, 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.sub appears in every audit event for requests it authorizes.
  • The full delegation chain (all nested act entries) is preserved in audit events in chronological order (original delegator first, current actor last).
  • Depth is capped and truncation is explicit (e.g. truncated: true flag) rather than silent.
  • Existing flat Subjects keys remain unchanged for backward compatibility.
  • Tests cover issuance → validation → audit extraction end-to-end.

References

Activity

  1. added
    enhancement
    go
    on Jul 27, 2026
  2. added
    needs-triage
    on Jul 27, 2026
  3. jhrozek commented on Jul 27, 2026

    @jhrozek
    Contributor

    thanks, I added the issue to the delegation epic

  4. removed
    needs-triage
    on Jul 28, 2026
  5. solara-associates commented on Oct 8, 2026

    @solara-associates

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

auditauthenticationauthorizationenhancementgo

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions