You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sign the proxy token (x-mesh-token / x-studio-token) with a public key and publish a JWKS #8440
Downstream MCP apps can't verify the per-user proxy token that Studio sends (x-mesh-token / x-studio-token).
issueStudioToken (apps/api/src/auth/jwt.ts) signs it with HS256 and the shared STUDIO_JWT_SECRET. Only the holder of that secret can verify the token, and the holder can also mint tokens for any user. Studio can't hand that secret to apps.
@decocms/runtime builds ensureAuthenticated() from decodeJwt, without checking the signature (packages/runtime/src/index.ts, withBindings).
So the only thing keeping a caller from claiming to be someone else is the app's bearer. Anyone who holds a connection's bearer can send an unsigned token with any user.email and the app accepts it as that user.
How we work around it today (decocms/ops-control-plane#319)
Our Workers send the token back to Studio as a bearer on GET /api/_me/organizations. A 401 means the token is forged or expired. A JSON response listing the token's org means it's genuine. Yeses are cached for up to 5 minutes.
This works, but it costs:
an extra round trip to Studio for every new token;
an outage for us whenever Studio is down (we fail closed);
a dependency on an endpoint that wasn't built for this.
Ask
Sign the proxy token with an asymmetric key (EdDSA or RS256), with a kid in the header and iss/aud claims. aud should be the connectionId, so a token minted for one app can't be replayed against another.
Publish the public keys at a stable JWKS URL, e.g. https://studio.decocms.com/.well-known/jwks.json, and keep old keys there during rotation.
In @decocms/runtime, verify the token with jwtVerify + createRemoteJWKSet before populating MESH_REQUEST_CONTEXT. Every MCP app then gets verified identity for free.
The AI Gateway token (mintGatewayJwt) can keep using HS256. This ask is only about the token that goes to downstream apps.
Once this ships, our withVerifiedCaller becomes a local jwtVerify that also checks aud = our connection.
Activity