Let tokens without an upstream session reach backends that need no per-user credential
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- go, kubernetes
調査の方向性
Start by reading pkg/auth/upstreamswap/middleware.go, especially createMiddlewareFunc, and trace how the token validator sets identity claims. The suggested first slice is the swap carve-out, tsid check, and unit tests; then review the separate acceptance criteria for authorization server, kind e2e, vMCP, and docs. Done means the relevant backend receives no user credential for marked sessionless tokens while interactive and expired-session behavior remains as specified.
索引モデルが issue の本文から書いたものです。
説明
Part of "Embedded auth server should accept SPIFFE SVIDs as client credentials" (#6199).
This is not SPIFFE-specific. private_key_jwt delegates, the JWT-bearer grant and ID-JAG redemption have the same problem. SPIFFE client_credentials is the case that needs one authorization-server change (see below).
This is a first sketch. The code facts below were checked on the SPIFFE stack branch. The vMCP behaviour, the MCPRemoteProxy headerForward end-to-end path, and the absence of a header-echo e2e backend are inferred, not run.
Problem
The embedded authorization server issues tokens with no tsid to SPIFFE workloads (client_credentials and RFC 8693 exchange), private_key_jwt delegates, and the JWT-bearer and ID-JAG grants.
On an MCPServer or MCPRemoteProxy whose embedded auth server has an upstream IdP, the upstream swap middleware answers these tokens with 401 "re-authentication required" (pkg/auth/upstreamswap/middleware.go, createMiddlewareFunc). It does this even when the backend needs no per-user credential at all. The agent cannot re-authenticate, so the message does not help it.
Seen on a kind cluster: a SPIFFE client_credentials token got that 401 at /mcp, while a real user's login token on the same server got 200.
Today's workarounds:
disableUpstreamTokenInjectionstrips credentials for every caller, interactive users included.- A second, token-only server in front of the same backend works, but doubles the deployment.
Proposed direction
- The swap treats
Identity.SessionlessGrantas "attach no credential". The token validator sets it only for a token from the embedded issuer that carries anactchain or the claimhttps://toolhive.dev/no_upstream_session. The swap stripsAuthorization,CookieandProxy-Authorizationitself, then forwards. There is no new setting: configuring the client is the opt-in. The authorization server only mints these tokens for a client the operator configured (a SPIFFE association, a delegate client or a trusted issuer), and the token's audience limits it to the resources that client lists. Every other caller keeps today's behaviour, including the 401 for a user whose upstream session has expired. - The SPIFFE
client_credentialshandler mints the marker. RFC 8693 outputs already carryact. JWT-bearer and ID-JAG tokens already carry the marker. The marker is not added to RFC 8693 outputs:actis the proof, and the marker would let a malformedactchain through. isSessionlessGrantadditionally refuses a token that carries atsid.- When the proxy also has outgoing token exchange, AWS STS or OBO middleware, sessionless tokens keep today's 401. Those middlewares read the
Authorizationheader and would act on a request that is meant to carry no credential. The combination is not rejected at config time, because that would break existing deployments. - The pass-through is keyed on the authorization server having affirmatively marked the token, never on the absence of upstream tokens.
Acceptance criteria
- On a server with an upstream, a SPIFFE
client_credentialstoken, a delegated token, a JWT-bearer token and an ID-JAG token reach the backend. A kind e2e shows the backend received noAuthorizationorCookieheader and no ToolHive JWT. - Interactive users on the same server still get their upstream token. Expired upstream sessions still get the 401 challenge.
- A proxy with outgoing token exchange, AWS STS or OBO keeps the 401 for these tokens.
- MCPRemoteProxy with
headerForward: the agent's request carries only the static header (kind e2e). - vMCP: a
header_injectionbackend serves the agent, and anupstream_injectbackend is excluded (kind e2e). - The pending delegation spec in the SPIFFE delegation e2e suite is un-pended.
- Docs and release note cover the Cedar change: SPIFFE
client_credentialstokens are evaluated on their own claims whenprimaryUpstreamProviderapplies, instead of being denied.
Out of scope
- Giving these tokens any user's stored upstream credential. That is the delegated-access work: "Delegated client access to a user's connections" (#6406) and its sub-issues.
- Giving headless callers an upstream ID token so they can reach
xaabackends, which is a credential-bearing case: "vMCP multi-upstream auth: scope refresh failures per provider, let headless callers reach xaa backends" (#7009). - Sender-constrained tokens.
- The fallback differences between outgoing strategies: "Outgoing strategies differ on no-subject-provider fallback" (#6177).
Open questions
- Is implicit enough, or is a per-client switch wanted later (for example a field on the association or delegate client) for an operator who configures such a client but does not want it to reach a given backend?
- Should the 401 text for sessionless callers change, since "re-authenticate" is something an agent cannot do?
- Should there be an audit field for "no upstream credential attached" (a follow-up)?
Per server type (what is believed today)
- Container MCPServer: no outgoing static-header path is needed. The container holds its own secrets, and header forwarding only installs for remote servers.
- MCPRemoteProxy: with a token-only auth server plus
headerForward, the runner should strip and then add the static header. No test runs this combination. - vMCP: it does not use the runner swap, and its
header_injectionandunauthenticatedstrategies ignore identity, so it probably works already.
Behaviour changes to name in the pull requests
- Tokens that existing delegate clients, JWT-bearer and ID-JAG already receive are now forwarded to the backend with no credential on a server with an upstream, instead of getting a 401. This is the cost of making it implicit, and it applies to deployments that exist today, not only to SPIFFE. A backend with an anonymous mode or an ambient credential would start answering them, and a server with no authorization policy does not limit them at the proxy (the second part is not verified).
- The Cedar outcome for SPIFFE
client_credentialstokens changes from denied to evaluated, so a broad permit policy would now admit them. - The exchange-grant source check will also start refusing
client_credentialstokens as subjects (inferred; check it). - The 401 text, if it changes.
Suggested split, one logical change each
- The proxy side: the swap carve-out, the
tsidhardening and unit tests. This alone unblocks delegated, JWT-bearer and ID-JAG tokens. - Docs and kind e2e for MCPServer and MCPRemoteProxy.
- The authorization server marks
client_credentialstokens, with the Cedar release note. This is what unblocks SPIFFEclient_credentials. Do not combine it with step 1, because it changes Cedar outcomes on its own. - vMCP e2e, and lowering a caller-triggered WARN to DEBUG.
Related
- "Allow the embedded auth server to run with zero upstream providers" (#6449)
- "Double auth transformation when MCPServer is behind VirtualMCPServer" (#4863)
- "MCPRemoteProxy + embeddedAuthServer: upstreamswap does not inject the stored per-user upstream token" (#6681)
- 主要言語
- Go
- スター
- 2.3k
- フォーク
- 326
- 平均マージ
- 1日 53分
- マージ済み PR(30日)
- 155
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stacklok/toolhive のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
stacklok/toolhive#6925 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
proxyrunner tool-filter middleware strips SEP-2322 Modern envelope from tools/list, breaking vMCP health checks再び着手できるかも @alex-feel が 46 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
stacklok/toolhive#6684 · コメント 5 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
HttpClientBuilder.Build() ignores HTTP(S)_PROXY (auth-server OAuth/DCR calls bypass forward proxy)対応中かも @schonmann が 37 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
stacklok/toolhive#6671 · コメント 2 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Delete the dead pkg/vmcp/server/adapter package再び着手できるかも @suantea が 30 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンneeds-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
Outgoing strategies differ on no-subject-provider fallback (xaa hard-fails, token_exchange and aws_sts fall back) and it is undocumented再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
stacklok/toolhive の issue をすべて見る
似ている issue
-
[bug]: scan-all update-schedule does not auto-convert 5-field cron expressions as documented対応中かも @vishnums2k5 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
goharbor/harbor-cli#1143 · コメント 1 件 ·
メンテナーはふだん 8 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
rossoctl/context-guru#1053 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] EphemeralJob matches every pod in the namespace when spec.selector is empty対応中かも @vishnums2k5 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
openkruise/kruise#2656 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信