Skip to content

audit: let vMCP embedders add caller subjects to audit events #7134

Closed

Description

@tgrunnagle

Problem

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.
type SubjectEnricher func(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

  1. added
    needs-triage
    on Nov 13, 2026
  2. self-assigned this
    on Nov 13, 2026
  3. removed
    needs-triage
    on Nov 13, 2026
  4. added a commit that references this issue on Nov 14, 2026
    87beabf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions