Skip to content

multi_valued_claims in MCPAuthzConfig is silently ignored for VirtualMCPServer #6737

Open

Description

@ngocketit

Bug description

When a VirtualMCPServer references an MCPAuthzConfig that sets multi_valued_claims, the setting is accepted and validated but never reaches the Cedar authorizer. As a result, the claimset_<name> attribute documented in the authz policy reference (Multi-valued claim normalization) is never created, and Cedar policies that use it always deny.

No validation error or warning is emitted, so the misconfiguration is invisible.

Reproduction

Given an MCPAuthzConfig:

apiVersion: toolhive.stacklok.dev/v1beta1
kind: MCPAuthzConfig
metadata:
  name: example-authz
spec:
  type: cedarv1
  config:
    multi_valued_claims: ["scope"]
    entities_json: "[]"
    policies:
      - |
        permit(
          principal,
          action == Action::"call_tool",
          resource == Tool::"example_get-weather"
        ) when {
          principal has claimset_scope &&
          principal.claimset_scope.contains("weather:read")
        };

referenced by a VirtualMCPServer via spec.incomingAuth.authzConfigRef, and a token whose claims (JWT or RFC 7662 introspection) include:

{
  "active": true,
  "sub": "user-123",
  "scope": "weather:read"
}

the tool is excluded from tools/list.

The gateway logs show:

Client::"user-123" does not have the attribute `claimset_scope`

Expected behavior

multi_valued_claims should be honored for VirtualMCPServer the same way it is for thv run, MCPServer, and MCPRemoteProxy: principal.claimset_scope should be a Cedar Set (["weather:read"]) and the policy above should permit the call.

If the field is intentionally unsupported for vMCP, the operator should reject it or surface a status condition instead of silently dropping it.

Actual behavior

The field is parsed into cedar.ConfigOptions.MultiValuedClaims, but the vMCP path copies only an allow-list of fields and drops it:

  1. cmd/thv-operator/pkg/vmcpconfig/converter.go, resolveAuthzConfigRef: builds vmcpconfig.AuthzConfig from Policies, EntitiesJSON, GroupClaimName, RoleClaimName, and GroupEntityType only. The ConfigMap branch of convertAuthzConfig has the same omission.
  2. pkg/vmcp/config/config.go: AuthzConfig has no MultiValuedClaims field.
  3. pkg/vmcp/auth/factory/incoming.go: builds cedar.ConfigOptions without MultiValuedClaims, so the authorizer runs with it empty and never adds claimset_* attributes.

Environment (if relevant)

  • ToolHive version: vmcp:v0.49.0

Suggested direction

Plumb MultiValuedClaims through the vMCP path the same way GroupClaimName/RoleClaimName are:

  1. Add MultiValuedClaims []string to vmcpconfig.AuthzConfig.
  2. Copy opts.MultiValuedClaims in resolveAuthzConfigRef and in the ConfigMap branch of convertAuthzConfig.
  3. Pass it into cedar.ConfigOptions in pkg/vmcp/auth/factory/incoming.go.
    Optionally, update the docs to note which deployment modes support multi_valued_claims until this lands.

Activity

  1. added
    bug
    on Oct 1, 2026
  2. added
    needs-triage
    on Oct 1, 2026
  3. Sanskarzz commented on Oct 4, 2026

    @Sanskarzz
    Collaborator

    Hi @lorenzozanee, thanks for raising the PR!

    Before starting work on an issue, please make sure it’s assigned to you first. Please leave a comment on the issue, and I can assign it to you.
    Please read CONTRIBUTING.md .

  4. suantea commented on Oct 11, 2026

    @suantea

    I've opened #6794 to plumb multi_valued_claims through the vMCP authz path (vMCP config + auth factory + operator converter). All targeted tests pass and build is clean.

  5. suantea commented on Oct 11, 2026

    @suantea

    Implemented in PR #6794 which also wires the OIDC transport flags and lockfile cleanup fix.

  6. added
    good-tenth-issue
    and removed
    needs-triage
    on Nov 12, 2026
  7. aponcedeleonch commented on Nov 12, 2026

    @aponcedeleonch
    Member

    Sorry for the slow response on this one, @ngocketit. We checked this against current main and your diagnosis still holds: the vMCP converter and buildCedarAuthzConfig in pkg/vmcp/auth/factory/incoming.go carry the group and role claim settings but not multi_valued_claims, so the claimset_* attributes never reach Cedar. Your suggested fix is the right shape.

    Would you like to pick it up? If so, say so here and I'll assign it to you. A few notes to save you a review round:

    • Add multiValuedClaims to the vMCP AuthzConfig and carry it through both the MCPAuthzConfig ref path and the ConfigMap path in the converter, plus buildCedarAuthzConfig.
    • That field ends up in the VirtualMCPServer CRD, so please regenerate the deepcopy, CRDs and docs/operator/crd-api.md with the operator Taskfile tasks rather than editing them by hand. Both served CRD versions need it.
    • A small guard test that fails when a cedar.ConfigOptions field isn't mapped through (with PrimaryUpstreamProvider as the one deliberate exclusion) would stop the next option from being dropped the same way.
    • A short upgrade note: deployments that already list multi_valued_claims will see claim_<name> change from a set to a joined string once it's honored.
    • Inline authz config is out of scope for this one.

    Please link the PR here with Fixes #6737.

  8. Sanskarzz commented on Nov 19, 2026

    @Sanskarzz
    Collaborator

    Hi @bharathvemula thanks for raising the PR!

    Before starting work on an issue, please make sure it’s assigned to you first. Please leave a comment on the issue, and I can assign it to you.
    Please read CONTRIBUTING.md .

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood-tenth-issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions