Workload Identity Credentials
Use a workload-identity credential when a service accepts tokens from Google Cloud or Microsoft Entra ID. Examples are an app behind Identity-Aware Proxy (IAP), a private Cloud Run service, or an API that checks Entra ID tokens.
Junior runs on Vercel. Vercel gives each deployment an OIDC token. Google Cloud and Azure can trust that token through workload identity federation. When sandbox traffic reaches a domain of the plugin, Junior swaps the OIDC token for a short-lived token on the host. Then it adds the token to the request. You do not store a cloud key, and the token never reaches the sandbox or the model.
The plugin needs no code. AWS is not supported, because AWS signs each request instead of using a token header.
Manifest
Section titled “Manifest”This example calls an app behind IAP. The app uses Authorization for its own API key, so the IAP token goes in Proxy-Authorization. IAP removes that header before the request reaches the app.
name: redashdisplay-name: Redashdescription: Query Redash behind Identity-Aware Proxy
env-vars: REDASH_API_KEY:
domains: - redash.example.comtools-send-no-credential: trueapi-headers: Authorization: Key ${REDASH_API_KEY}
credentials: type: workload-identity domains: - redash.example.com header: Proxy-Authorization gcp: workload-identity-provider: projects/123456789/locations/global/workloadIdentityPools/vercel/providers/junior service-account: junior-redash@my-project.iam.gserviceaccount.com token: service-account-jwt audience: https://redash.example.com/*| Field | Value |
|---|---|
domains |
Hosts that get the token. |
header |
Authorization (default), Proxy-Authorization, or X-Serverless-Authorization. Junior sends Bearer <token>. |
gcp |
Google Cloud settings. Set gcp or azure, not both. |
azure |
Microsoft Entra ID settings. |
Junior adds the token only to a request that asks for it. curl and most tools send no credential, so set tools-send-no-credential: true. A tool can also send Bearer host_managed_credential in header, and Junior replaces it with the token. A request that sends its own value in header or Authorization keeps that value. See Placeholders.
Top-level api-headers can add other headers for the same domains, but they must not set the header name.
Values in gcp and azure are not secrets. They can use ${NAME} refs to declared env-vars, with or without a default.
Google Cloud fields
Section titled “Google Cloud fields”| Field | Value |
|---|---|
workload-identity-provider |
projects/<number>/locations/global/workloadIdentityPools/<pool>/providers/<provider> |
service-account |
Email of the service account that Junior impersonates. |
token |
service-account-jwt, id-token, or access-token. |
audience |
For service-account-jwt and id-token. An https URL on the one host in domains. For IAP, use https://<host>/*. For Cloud Run, use the service URL. |
scopes |
For access-token. A list of read-only Google API scopes, such as https://www.googleapis.com/auth/bigquery.readonly. |
Use service-account-jwt for IAP, id-token for Cloud Run with X-Serverless-Authorization or Authorization, and access-token for Google APIs such as BigQuery. Tokens last one hour. Junior mints a new token about five minutes before the old one expires.
Token targets
Section titled “Token targets”All plugins federate as the same Vercel deployment. So a manifest can name any service account or app that the deployment can use, and plugin manifests are trusted operator config. Junior limits where each token can go:
- Junior sends a token only to the plugin’s own
domains, and two plugins cannot list the same domain. - A
service-account-jwtorid-tokengoes only to the host of itsaudience, sodomainsmust list only that host. Another plugin cannot get a token for your service. - An
access-tokenworks on every Google API that the service account can use. So alldomainsmust be Google API hosts (*.googleapis.com). - An
access-tokencan only have read-only scopes, which end in.readonly,.read-only, or.read_only. Everyone who uses Junior shares the token, so Junior rejects a scope that can write. Also give the service account only read roles, such asroles/bigquery.dataViewer. - Two plugins cannot use the same service account, or the same Azure tenant and client ID.
Junior cannot bind an access-token or an Azure scope to one service. For these, IAM is the limit: give the service account or app access to the one upstream that the plugin needs, and no more.
Azure fields
Section titled “Azure fields”credentials: type: workload-identity domains: - api.example.com azure: tenant-id: 00000000-0000-0000-0000-000000000000 client-id: 11111111-1111-1111-1111-111111111111 scope: api://my-api/.defaultscope sets the API that the access token is for.
Set up Google Cloud
Section titled “Set up Google Cloud”-
Create a workload identity pool and an OIDC provider. Set the issuer to match your Vercel issuer mode:
https://oidc.vercel.com/<team-slug>for Team, orhttps://oidc.vercel.comfor Global. Select Allowed audiences and enterhttps://vercel.com/<team-slug>. Junior sends the deployment’s own OIDC token, and that is its audience. See Vercel OIDC for Google Cloud. -
Map
google.subjecttoassertion.sub. -
Add an attribute condition that trusts only production:
Attribute condition assertion.sub == "owner:<team-slug>:project:<project-name>:environment:production"Team members can pull development OIDC tokens to their own computers. Without this condition, those tokens can mint the same credentials.
-
Create one service account for each plugin. Junior rejects two plugins that use the same one. Give it access to that one upstream only. For IAP, grant it IAP-secured Web App User on the protected resource. For Cloud Run, grant it Cloud Run Invoker on the service.
-
On the service account, grant the workload identity principal the smallest role for the token kind:
tokenRole service-account-jwtroles/iam.serviceAccountTokenCreatorid-tokenroles/iam.serviceAccountOpenIdTokenCreatoraccess-tokenroles/iam.workloadIdentityUserThe principal is
principal://iam.googleapis.com/projects/<number>/locations/global/workloadIdentityPools/<pool>/subject/owner:<team-slug>:project:<project-name>:environment:production.
The Token Creator role also lets the holder mint access and ID tokens for the service account. This is why each plugin needs its own service account.
Service accounts cannot pass IAP access levels that check the device. Grant the service account its IAP role without a device-based access level condition. Otherwise Junior gets HTTP 403. See IAP programmatic authentication.
Set up Azure
Section titled “Set up Azure”-
Register an application in Microsoft Entra ID. Copy the application (client) ID and the directory (tenant) ID.
-
Add a federated credential with the scenario Other:
- Issuer:
https://oidc.vercel.com/<team-slug> - Subject:
owner:<team-slug>:project:<project-name>:environment:production - Audience:
api://AzureADTokenExchange
Entra ID needs an exact subject match. Do not add credentials for preview or development.
- Issuer:
-
Grant the application access to the target API, for example with an app role.
Verify
Section titled “Verify”Run junior check to validate the manifest. Then ask Junior to call the service from the sandbox, for example with curl https://redash.example.com/api/session.
If a token exchange fails, the command fails with a message such as Could not mint the redash workload identity credential: Google IAM Credentials returned HTTP 403. The message names the failing step: Vercel OIDC, Google STS, Google IAM Credentials, or Microsoft Entra ID. Junior does not ask anyone to connect an account. Fix the trust or role setup for that step.
If the token is minted but the service returns HTTP 401, the message is Upstream rejected the redash workload identity credential with HTTP 401. Check the trust setup and the token audience or scope.
An HTTP 403 goes back to the command with the service’s own response body, such as a BigQuery accessDenied or quotaExceeded error. Junior keeps the token, because a new token acts as the same service account or app. Check the role that it has on that service. For a plugin that also sends static api-headers, also check those values.
Next step
Section titled “Next step”Read Security & Authority for how Junior keeps credentials out of the sandbox.