Capture RFC 8693 act claim in audit logs - #6046
Merged
Merged
Conversation
JAORMX
requested review from
ChrisJBurns,
amirejaz,
aponcedeleonch,
jhrozek,
rdimitrov,
reyortiz3 and
tgrunnagle
as code owners
July 27, 2026 18:52
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6046 +/- ##
==========================================
+ Coverage 72.26% 72.32% +0.06%
==========================================
Files 722 725 +3
Lines 75138 75443 +305
==========================================
+ Hits 54296 54567 +271
Misses 16980 16980
- Partials 3862 3896 +34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add first-class support for the RFC 8693 actor claim in ToolHive's audit pipeline so delegated requests record the full chain of acting parties, not just the terminal subject. - Introduce auth.DelegationChain and auth.ParseDelegationChain to parse nested act claims with a bounded depth (default 10, aligned with the token-exchange issuance cap) and explicit truncation reporting (dropped_count). - Promote the parsed chain into auth.Identity / auth.PrincipalInfo during claimsToIdentity so downstream consumers see it as a structured field rather than an opaque JWT claim. - Extend audit.AuditEvent with a delegationChain member and teach both the HTTP Auditor and WorkflowAuditor to populate it from the request identity, respecting the configured maxDelegationDepth. - Cover issuance → validation → audit extraction with unit tests, middleware-level tests (including SSE stream opens), and an end-to-end integration test that mints a delegated token via the real token-exchange handler and asserts the audit event. - Document the new audit field and maxDelegationDepth config knob; regenerate operator CRD/swagger docs. Closes #6035
Run task operator-manifests and task crdref-gen to pick up the new maxDelegationDepth audit config field introduced in #6035.
JAORMX
force-pushed
the
audit-act-claim-6035
branch
from
July 28, 2026 07:17
4dc3335 to
7d0d474
Compare
amirejaz
approved these changes
Jul 28, 2026
JAORMX
added a commit
that referenced
this pull request
Jul 28, 2026
Main gained CRD-affecting changes (#6092, #6046, #6086) after the previous merge, so the Generate CRD Docs check fails against the merge result until docs/operator/crd-api.md is regenerated on top. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5WXPQr5Da9Cox2nZWhg6n
This was referenced Jul 28, 2026
5 tasks
5 tasks
10 tasks
JAORMX
added a commit
that referenced
this pull request
Jul 28, 2026
All eight WorkflowAuditor.Log* methods hand-copied the same four-step prologue (extract source, extract subjects, build the event, attach the delegation chain). PR #6046 had to patch all eight copies by hand and six of them were not covered by tests, which is how call sites drift. Extract a private newEvent(ctx, eventType, outcome) helper and route every Log* method through it, so attaching the delegation chain is guaranteed by construction rather than by repetition. No behavior change. Shrink the eight-case delegation test table to a single test on the helper; the no-identity and max-depth subtests keep pinning the emitted log shape end-to-end. Closes #6095 Claude-Session: https://claude.ai/code/session_01W1kKpsGZTfSgKBi8GdTZXR Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The embedded authorization server already mints delegated JWTs with the RFC 8693
actclaim and supports nestedactfor multi-level delegation (pkg/authserver/server/tokenexchange/handler.go). However, when those tokens are presented to the proxy / vMCP request-serving path, audit events only recorded the terminalsub(the original user). It was 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.This change captures the full delegation chain in every audit event for requests authorized by a delegated token:
auth.DelegationChain/auth.ParseDelegationChainto parse nestedactclaims with a bounded depth (default 10, aligned with the token-exchange issuance cap) and explicit truncation reporting (dropped_count).auth.Identity/auth.PrincipalInfoduringclaimsToIdentityso downstream consumers see it as a structured field rather than an opaque JWT claim.audit.AuditEventwith adelegationChainmember and teaches both the HTTPAuditorandWorkflowAuditorto populate it from the request identity, respecting the configuredmaxDelegationDepth.Closes #6035
Type of change
Test plan
task test)task lint-fix)API Compatibility
v1beta1API, OR theapi-break-allowedlabel is applied and the migration guidance is described above.Changes
pkg/auth/delegation.goDelegationChain,DelegatedActor,ParseDelegationChain,DefaultMaxDelegationDepthpkg/auth/identity.goDelegationChain *DelegationChaintoPrincipalInfoandMarshalJSONpkg/auth/context.goactclaim into identity duringclaimsToIdentitypkg/audit/event.goDelegationChainfield andWithDelegationChainbuilder; emit inLogTopkg/audit/config.goMaxDelegationDepth *intandMaxDelegationDepthOrDefault()pkg/audit/auditor.gologAuditEventandlogSSEConnectionEventpkg/audit/workflow_auditor.gopkg/authserver/integration_test.gopkg/audit/auditor_test.gopkg/audit/workflow_auditor_test.gopkg/auth/*_test.godocs/middleware.mddelegation_chainaudit fielddocs/arch/02-core-concepts.mddocs/server/*Does this introduce a user-facing change?
Yes. Audit events for requests authorized by delegated tokens now include a
delegation_chainfield that lists the acting parties (outermost first) and atruncated/dropped_countindicator when the chain exceeds the configured depth cap. ThemaxDelegationDepthaudit config knob (default 10) is now available.Implementation plan
Approved implementation plan
DelegationChain/ParseDelegationChaintype inpkg/auth.actintoIdentity/PrincipalInfoduringclaimsToIdentity.AuditEventwithdelegationChainwhile keepingSubjectsbackward compatible.Special notes for reviewers
maxDelegationDepthinpkg/authserver/server/tokenexchange/handler.go:31andmaxClaimNestingDepthinpkg/authz/authorizers/cedar/entity.go:18.SetLogWriterForTestis marked deprecated in favor of a futureNewAuditorWithWriterconstructor.