Skip to content

Bind gateway access tokens to the caller's key (DPoP or mTLS) #3003

Backlog

Description

@ChrisJBurns

Depends on: ToolHive issuance at AS-2 and validation at the vMCP (not filed yet; to be added to "ToolHive work for phase 2" in #2545). Not blocked by #2807 (the broker as its own service), but worth more after it. Scope to be refined.

Problem

A gateway access token (V) is a bearer token. Anyone who holds V and the vMCP session ID can use it as mecak8s would: start the one call it names before exp, and, once that call has started, send the call's messages (cancellation, elicitation replies, GET and DELETE on its session) while the call is open, up to the maximum call duration, even after V expires (stacklok/toolhive#7062, stacklok/toolhive#7339). The per-call binding limits what a stolen V can do, not who can use it.

Today the gap is small: V and the session ID live only in mecak8s, and while the broker runs inside mecak8s, an attacker who can read them there already holds AS-1's signing key and the broker's client key (threat-model.md: A compromised mecak8s). It matters more once the broker is split out (#2807) and with external gateways (#2810), where V crosses more hops.

Implements

Scope (draft)

  • Sender-constrain V: AS-2 binds it to a key the presenter holds (cnf), and the vMCP refuses any request that does not prove possession of that key, including the messages it accepts after exp for an open call.
  • Options:
    • DPoP (RFC 9449): a signed proof on every request (method, URL, access-token hash). No PKI, and it survives TLS termination at an ingress.
    • mTLS-bound tokens (RFC 8705): V bound to a client certificate's thumbprint. Needs client certificates end to end to the vMCP, which TLS termination at an ingress breaks unless the certificate is forwarded and trusted.
  • Refusals follow the chosen RFC (for DPoP, 401 with WWW-Authenticate: DPoP error="invalid_dpop_proof"), and are audited like the vMCP's other token refusals.

Decide before starting

  • DPoP or mTLS?
  • Whose key: the broker's (the design's wording) or mecak8s's MCP client, which sends the call? A DPoP proof is per request, so a broker key means the broker signs a proof for every message mecak8s sends, including cancellations and elicitation replies.
  • Before or after the split ([Phase 3] Run the identity broker as its own service #2807)? Before it, binding still stops a V that leaks outside mecak8s (logs, traces, intermediaries), but not one taken from a compromised mecak8s, which holds the key too. Inside one process, the key proves the process, not the agent.
  • External gateways: required, or used only when the gateway advertises support (for DPoP, dpop_signing_alg_values_supported)?

Does not solve

As the design notes: binding V to a worker's key does not establish which agent inside that worker made a call, and does not protect against a compromised worker using its own key.

Done when

To be set once the questions above are answered.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions