You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
audit: let vMCP embedders add caller subjects to audit events #7134
A vMCP embedder cannot add caller attributes to audit events. extractSubjectsFromIdentity (pkg/audit/auditor.go) builds subjects from a fixed set: user_id, user, client_name, client_version. An embedder that knows more about the caller has no way to record it. Examples:
The OAuth client id the access token was issued to. Its claim differs by IdP (client_id per RFC 9068, cid on Okta, azp on Entra v2.0), so only the embedder knows which claim to trust.
Whether the caller is a human user or a workload identity.
An internal user id the embedder resolved, when it differs from the token's sub.
The RFC 8693 delegation chain is already recorded, so an agent acting for a user is visible. The client the agent used is not.
Proposal
An optional subject enricher, set from Go and never from the serialized audit.Config:
// SubjectEnricher returns extra audit subjects for a request.typeSubjectEnricherfunc(ctx context.Context, identity*auth.Identity) map[string]string
It takes a context rather than a request, because the workflow auditor builds events from a context (newEvent).
It is passed through the vMCP server config and the core config, so both the per-request MCP audit middleware and the workflow auditor apply it.
Returned keys are added to subjects. Keys the auditor already writes (user, user_id, client_name, client_version) are never overwritten, and empty values are dropped.
With no enricher set, events are byte-for-byte unchanged.
It runs only when audit is enabled.
Acceptance
An enricher returning {"client_id": "abc"} produces an event whose subjects.client_id is abc.
An enricher returning {"user": "x"} leaves the built-in user value in place.
With no enricher, existing audit tests pass unchanged.
A composite-tool workflow event carries the enricher's subjects too.
Out of scope
New typed fields on auth.PrincipalInfo. That type is also the policy-webhook principal payload, so embedder-specific attributes stay out of it.
Activity
Let vMCP embedders add audit event subjects (stacklok#7135)