Repository navigation
Description
Part of "Delegated client access to a user's connections" (#6406). Uses the
reader from "User-keyed upstream storage behind the embedder option" (#7263).
Why. A delegated token (an access token from ID-JAG redemption that names
a real user, for a scheduled agent run, say) has no tsid, so today the vMCP
loads no upstream credential for it and the backend call fails, even when the
user connected the provider. This issue lets that token use the user's own
credential for the one provider the called tool is routed to, and nothing
else.
Part A: the validator records how a token got in.
A new value on Identity:
| Token from the embedded issuer carries | Value |
|---|---|
tsid, no delegated-access marker |
interactive |
the marker, no tsid |
delegated |
neither (for example a may_act exchange) |
sessionless |
| any token from another issuer, or a validator not bound to the embedded issuer | unspecified |
tsidand the marker together: 401invalid_token, logged at WARN with the
cause.- The marker is honoured only on a token from the embedded issuer. On any
other token it is ignored and grants nothing. - Classification runs only when the validator is bound to the embedded issuer
(WithEmbeddedAuthServerIssuerset and equal to the validator's issuer).
Otherwise the value is unspecified and nothing changes. SessionlessGrantkeeps its meaning and still governs only the re-sign-in
challenge. Marked tokens keepno_upstream_session.- No Cedar change: a marked token already reaches Cedar's session-less path,
so policy sees the request token's claims, includingact.
Part C: delegated calls read through the reader.
- On the delegated route,
upstream_injectreads the routed backend's
provider throughUserCredentialReader, and so do the subject-provider
lookups of token exchange, AWS STS and cross-app access. They do not use
Identity.UpstreamTokens. Other routes are unchanged, including injection
fromIdentity.UpstreamTokensthat embedders fill themselves. - The reader reaches the strategies through an exported option, so an
embedder that registersupstream_injectitself can pass its reader. The
vMCP command builds the reader before it discovers backends
(pkg/vmcp/cli/serve.go). - The reader reads the row of the user the validated delegated token names
(itsIdentity). It trusts the user ID it is given, so that ID never comes
from the request body, a header or the tool arguments. - The vMCP builds the reader on the same refresher as its other upstream
reads, so a row that two paths refresh at once is refreshed once per
process. - When storage is user-keyed, the vMCP refuses to start if its token
validator is not bound to the embedded issuer, has no audience, or does
not verify tokens with the in-process key provider. Today such a validator
loads no upstream credential and only logs at DEBUG, which is hard to
diagnose. - The delegated route reads only when storage is user-keyed (the embedder
option from "User-keyed upstream storage behind the embedder option" (User-keyed upstream storage behind the embedder option #7263), or
runner-built storage once "Re-authorization walks the full upstream chain
instead of evaluating existing credentials" (Re-authorization walks the full upstream chain instead of evaluating existing credentials #6831) lands) or the embedder
supplies its ownUserCredentialReader. Otherwise a delegated call fails
closed per request with an infrastructure error. It never falls back to
Identity.UpstreamTokens. - No connection, or a refresh rejected with
invalid_grant, at call time:
the call fails with a tool error that names the provider, never 401 or 403.
Other tools keep working. Storage and transient refresh errors:
infrastructure error. Another user's row: a generic 500. Storage that
reports no canonical user for the call: an infrastructure error, never
"not connected". A backend whose
provider the user never connected fails discovery and is dropped from the
session before any call, so its tools are absent; keeping the session and
routing such calls is "vMCP: keep a delegated session and route calls when
the user has not connected a backend's provider" (vMCP: keep a delegated session and route calls when the user has not connected a backend's provider #7189). - Cross-app access needs a valid ID token. The reader can return a
credential whose ID token has expired when the refresh for it failed (the
access token is still valid), so cross-app access checks the ID token's
expiry and fails the call with the tool error that names the provider. - The connect link and the URL elicitation are "vMCP: answer a call for an
unconnected provider with a URL elicitation carrying the connect link"
(vMCP: answer a call for an unconnected provider with a URL elicitation carrying the connect link #7188), after this.
Delegated sessions are bound to their client and agent in "vMCP: bind
sessions to the client, acting agent, and delegated-access marker, not just
the user" (#6888).
Acceptance.
- Unit: classification table, including
tsid+ marker refused and a marker
ignored on a validator not bound to the embedded issuer; the interactive
path produces the sameIdentityas before. - Unit per strategy: reader used on the delegated route,
Identity.UpstreamTokensignored; fail closed with no reader; the named
error; the generic 500 for another user's row; an infrastructure error,
not the named error, when storage reports no canonical user; a user ID in
the tool arguments does not change which row is read. - Unit, cross-app access: a credential with an expired ID token fails the
call with the named error. - In-process: a self-issued
may_actexchange for a user with a connection
reads nothing; a marker from another issuer is ignored; an expired
credential is refreshed on the delegated path with deduplication; a dead
provider does not fail an unrelated tool; with storage that is not
user-keyed and no reader of the embedder's own, a delegated call fails
closed. - In-process, embedder: an embedder registers
upstream_injectwith its own
reader through the exported option, and a delegated call reaches the
backend with the user's token. - Startup: with user-keyed storage, a validator that is not bound to the
embedded issuer, has no audience, or has no in-process key provider stops
the vMCP with an error that names the missing setting.
Depends on. Part C: "User-keyed upstream storage behind the embedder
option" (#7263) (the reader).
Changed from the earlier text. No opt-in setting, no stable session ID,
no read in the validator, no Cedar predicate, no owner parameter on
tsid-keyed reads. The reader moved to the storage issue. No longer blocked
on "Add upstreamCredentialScope opt-in and enforce its issuer trust" (#6403), "Upstream token read cannot verify ownership: ErrInvalidBinding documents a subject check the signature cannot make" (#6176) or "Embedded auth runtime DCR does not bind upstream refresh tokens to the DCR client generation" (#6508).
Added (2026-11-25), after the review of "User-keyed upstream storage behind
the embedder option" (#7263). Where the user ID comes from, the shared
refresher, the startup check, the no-canonical-user error and the ID-token
check for cross-app access. Nothing was removed.
Activity
[-]User-keyed upstream credential read for delegated agent tokens[/-][+]Ownership-checked credential read for delegated tokens, keyed by user and routed provider[/+]ChrisJBurns commentedon Nov 18, 2026
The "needs authorization" answer this issue defines is turned into a URL elicitation for clients that declared URL mode in #7188; keeping the session and routing the call to that check when the user hasn't connected the provider is #7189.
Record how a token was admitted on Identity (#7287)
ChrisJBurns commentedon Nov 27, 2026
@jhrozek, who's taking Part C (delegated calls read through
UserCredentialReader, and the exported option for embedders that registerupstream_injectthemselves)? Its dependency, #7263, closed on 2026-11-26, and Part A shipped in v0.69.1.On Mecatl's side, Part C is now the last open blocker on the path to "Delegated access: turn on subject resolution at ID-JAG redemption" (#7247), and so to finishing Mecatl's phase 1: stacklok/mecatl#2533, #2537, #2729 and #2542 all wait on it. If it would help, someone from the Mecatl side could pick it up.
jhrozek commentedon Nov 27, 2026
I'm on it. Part C is split into a few PRs: #7350 and #7351 are merged, and #7353 (surfacing delegated credential errors) and #7354 (one owner for the per-user refresh worker) are open. Next is
upstream_injectreading through the reader, with the exported option. That's all Mecatl needs, so I'd like #7247 to wait only on that. The remaining strategies (token_exchange,aws_sts,obo,xaa) fail closed on delegated tokens until then and can follow separately. Reviews on #7353 and #7354 would help most right now. Thanks for the offer!jhrozek commentedon Nov 27, 2026
Closing this as done. Part A landed earlier, and the
upstream_injectread with the exported reader option landed in #7355, along with #7350, #7351, #7353 and #7354. That's everything the delegated path needs for #7247.The rest of part C (
token_exchangeincluding OBO,aws_sts,xaa, thethv vmcp servewiring and its startup check) moved to "Read delegated credentials in token_exchange, aws_sts and xaa, and in thv vmcp serve" (#7359). Those strategies fail closed on delegated tokens until it lands, so nothing in phase 1 waits on it.