Skip to content

vMCP: bind sessions to the client, acting agent, and delegated-access marker, not just the user #6888

Done

Description

@jhrozek

Problem. A vMCP session is bound to the user only. Once delegated
tokens reach the gateway, another client, or another agent acting for the
same user, could ride a delegated session and its cached state, and a
delegated token could pick up the user's interactive session.

Change.

  • A session opened by a delegated token (route delegated, from
    "Ownership-checked credential read for delegated tokens, keyed by user
    and routed provider" (Ownership-checked credential read for delegated tokens, keyed by user and routed provider #6407)) is bound to the route, the user, the
    client_id, and the acting agent (act.iss, act.sub). Not to jti,
    authorization_details or exp, which change per token.
  • A request whose token differs on any of these is refused for that
    session, on every method including list methods. An interactive session
    cannot be used by a delegated token of the same user, and the reverse.
  • Interactive sessions keep today's binding, byte for byte.
  • Sessionless sessions (token exchange, JWT-bearer) keep today's binding
    in this issue. Binding them too needs a release whose parser accepts
    both formats first, so sessions created before an upgrade, or on a
    replica still on the old version, are not dropped.
  • The binding lives in the shared pkg/auth/sessionbinding package, so
    MCPServer proxies get the same rule.

Acceptance. A delegated session reused by another client or agent is
refused, list methods included, on the vMCP and on an MCPServer proxy; an
interactive session reused by a delegated token of the same user is
refused, and so is a delegated session reused by an interactive token of
the same user; interactive and sessionless sessions bind exactly as before.

Metadata

Metadata

Assignees

No one assigned

    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