Let tokens without an upstream session reach backends that need no per-user credential
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go, kubernetes
- Lĩnh vực
- authentication, backend-api-design
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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)
- Ngôn ngữ chính
- Go
- Star
- 2.3k
- Fork
- 326
- Merge trung bình
- 1 ngày 53 phút
- Pull request đã merge (30 ngày)
- 155
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của stacklok/toolhive
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
stacklok/toolhive#6925 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
proxyrunner tool-filter middleware strips SEP-2322 Modern envelope from tools/list, breaking vMCP health checksCó thể làm lại được @alex-feel đã nhận 46 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
stacklok/toolhive#6684 · 5 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
HttpClientBuilder.Build() ignores HTTP(S)_PROXY (auth-server OAuth/DCR calls bypass forward proxy)Có thể đã có người làm @schonmann đã nhận 37 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
stacklok/toolhive#6671 · 2 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Delete the dead pkg/vmcp/server/adapter packageCó thể làm lại được @suantea đã nhận 30 ngày trước và không có pull request nào đang mở. Đang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Outgoing strategies differ on no-subject-provider fallback (xaa hard-fails, token_exchange and aws_sts fall back) and it is undocumentedCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của stacklok/toolhive
Issue tương tự
-
[bug]: scan-all update-schedule does not auto-convert 5-field cron expressions as documentedCó thể đã có người làm @vishnums2k5 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
goharbor/harbor-cli#1143 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 8 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
--info inline-right:PREFIX leaves the first character of the prefix when the info gets shorterĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
rossoctl/context-guru#1053 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] EphemeralJob matches every pod in the namespace when spec.selector is emptyCó thể đã có người làm @vishnums2k5 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
openkruise/kruise#2656 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày