Llim.run

Authenticate with workload identity federation

Use an OIDC token from your identity provider to authenticate CI jobs or services to Limrun, instead of storing a Limrun API key. It works like workload identity federation on Google Cloud and Azure, or OIDC federation on AWS. An organization admin registers an identity provider, then creates permission bindings for its workloads. The CLI or SDK exchanges the token for a short-lived Limrun access token and renews it as needed.

For code running inside a Limrun instance, use an instance role.

For step-by-step setup on a specific platform, see GitHub Actions, GitLab.com, Google Cloud, AWS, Kubernetes, or E2B. This page covers what applies to every identity provider.

Register a provider and create a binding

You need an organization admin session and an identity provider that issues signed JWTs with iss, aud, sub, and exp claims. Its signing keys must be available at a public HTTPS JWKS URL. Limrun accepts RS256, RS384, ES256, ES384, PS256, and PS384 signatures. Redirects from the JWKS URL are not followed. If the JWT includes nbf, Limrun allows up to 30 seconds of clock skew; expiry remains strict.

To configure access in the console:

  1. Select the organization whose resources the workload needs to access.
  2. Open Settings, then Workload identity federation, and click the + button next to Identity providers.
  3. In Issuer, choose your platform: Google Cloud Platform (GCP), Amazon Web Services (AWS), Kubernetes, E2B, GitHub Actions, or GitLab.com. Choose Other identity provider for anything else. Then enter the fields the preset leaves open: a provider name, the token's exact issuer URL, the public JWKS URL, and the expected token audience, which defaults to limrun.
  4. Set Provider condition (CEL) to restrict the trusted tenant, for example, assertion.tenant == 'team-123'. Use true if you need no provider-wide condition and the issuer signs only for you. Click Create provider.
  5. In the new provider's card, click the + button next to Bindings and enter a name. The binding belongs to that provider.
  6. Set Claim condition (CEL) to select the intended workloads, for example, assertion.environment == 'production'.
  7. Enter one fixed permission per line, such as xcode:*:all and asset:name/builds/*:all.
  8. Set Maximum session duration (seconds). The default is 900 seconds.
  9. Click Create binding, then expand Setup on the saved binding to copy its environment variables. Replace the identity file path with the path your identity provider writes to.

Use Test condition beside either CEL field to try a condition against sample JSON claims. Enter the claims object directly, such as {"tenant":"team-123","environment":"production"}; the expression accesses it through assertion. The dialog runs locally and shows Pass, Deny, or an input error. Select Use condition to copy the expression back into the form. This tests one condition, not the JWT signature or the complete token exchange. Server validation remains authoritative.

Each provider has its own card with its bindings listed below the trust configuration. One provider can have several bindings with different workload conditions and permissions. Both the provider condition and the binding condition must pass. Only organization admins can manage these settings. The binding ID is a configuration identifier, not a secret.

Create a provider and binding through the API

Send these requests to https://api.limrun.com. Authenticate with the admin's member session in the Authorization Bearer header. API keys and workload credentials cannot administer providers or bindings.

First, send POST /v1/organizations/{organizationId}/federation_providers with your provider's configuration:

{
  "name": "Production identity service",
  "issuer": "https://identity.example.com",
  "jwksUrl": "https://identity.example.com/.well-known/jwks.json",
  "audience": "limrun-builds",
  "condition": "assertion.tenant == 'team-123'",
  "enabled": true
}

Save the returned id, which begins with federationprovider_. Use it as providerId in a POST /v1/organizations/{organizationId}/federation_bindings request:

{
  "name": "Production builds",
  "providerId": "federationprovider_REPLACE_WITH_PROVIDER_ID",
  "condition": "assertion.environment == 'production'",
  "permissions": ["xcode:*:all", "asset:name/builds/*:all"],
  "maxSessionDurationSeconds": 900,
  "enabled": true
}

The binding response includes an id beginning with binding_. Use this binding ID in the SDK configuration. The SDK does not need the provider ID.

Each condition is a boolean Common Expression Language expression. assertion contains the verified JWT claims. Restrict access to your tenant and intended workloads, especially when the issuer serves multiple customers. Missing claims, evaluation errors, and a false result deny the exchange.

Some issuers sign tokens for every customer of their service, and anyone with an account there can request one with your audience. For these issuers, Limrun refuses to save an enabled provider whose condition never reads a claim that names the token's owner:

IssuerRecommended provider condition
https://token.actions.githubusercontent.comassertion.repository_owner_id == '<owner-id>'
https://gitlab.comassertion.namespace_id == '<namespace-id>'
https://accounts.google.comassertion.sub == '<service-account-unique-id>'
https://id.e2b.devassertion.sub.startsWith('spiffe://id.e2b.dev/<project-id>/')

Prefer numeric IDs over names, because an account can be renamed and its old name claimed by someone else. The check only confirms that the condition reads an owner claim, so review that the comparison restricts access to you. Narrow further in each binding, for example by repository, branch, or E2B template.

A binding grants a fixed list of 1 to 100 permissions. Every matching identity receives that list; claim interpolation such as ${assertion.sub} is not supported. You must hold every permission you grant.

Federation bindings accept these resource types:

Each resource accepts only its supported actions. Bindings cannot grant organization, member, billing, or apikey permissions, or wildcard resource types such as *:*:all or *:*:read. Wildcards in resource IDs remain supported, for example, xcode:*:all and asset:name/builds/*:read.

Limrun checks these restrictions when you create or update a binding and again when exchanging a token. Including accesstoken:*:all allows narrower token delegation; it does not let the workload add permissions outside the binding's grant. See Permissions and access tokens for resource names and actions.

Signing key refresh

Limrun fetches and validates signing keys when you create an enabled provider. It also fetches keys when you enable a provider, change its issuer or JWKS URL, or save a provider whose keys have expired. A failed fetch leaves the existing configuration unchanged. Malformed JWKS and invalid endpoint settings return HTTP 400; temporary fetch failures return HTTP 503.

Limrun refreshes the stored keys automatically after 48 minutes, 80% of their one-hour lifetime, even when no workloads are exchanging tokens. Token exchanges use the stored keys and do not fetch the JWKS URL. A token signed with an unknown key returns invalid_grant without triggering a refresh.

Publish new signing keys at least one refresh interval before using them, and keep old keys published while their tokens remain valid. Allow time for changes to propagate between regions. Removing a key does not revoke Limrun tokens already issued.

If a refresh fails, the previous keys remain usable until their original expiry. Missing or expired keys cause exchanges to return HTTP 503 with temporarily_unavailable. Honor Retry-After before retrying with backoff; its value is a delay hint, not a guarantee that the keys will be available. An invalid or expired JWT still returns invalid_grant when valid signing keys are available.

Configure your workload

Point the CLI or SDK at your binding and at one source for the JWT. Choose the source by how your platform delivers the token:

SourceUse it whenEnvironment variable
A fileYour runtime writes the JWT to a file and replaces it as it rotates, such as a Kubernetes projected token.LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE
The tokenYour code already holds the JWT, such as a CI job that requests one.LIMRUN_WORKLOAD_IDENTITY_TOKEN
InjectedAn egress proxy adds the JWT to outbound requests, and the workload never sees it.LIMRUN_WORKLOAD_IDENTITY_TOKEN_INJECTED=true

Set LIMRUN_WORKLOAD_IDENTITY_BINDING_ID to the binding ID next to the source. Explicit SDK options take precedence over environment variables, and a token takes precedence over a file. An injected token cannot be combined with another source.

Remove LIM_API_KEY from this workload's environment. An API key takes precedence over workload identity when both are configured. Set LIMRUN_STS_BASE_URL only if you need a token service other than https://sts.limrun.com. The CLI supports workload identity from version 0.63.0, and the TypeScript SDK from 0.77.2.

Read the JWT from a file

The file contains the JWT itself, without a JSON wrapper or a Bearer prefix. Each surface reads the file again whenever it needs a new Limrun token:

export LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE=/var/run/identity/token
export LIMRUN_WORKLOAD_IDENTITY_BINDING_ID=binding_REPLACE_WITH_BINDING_ID
lim whoami
import Limrun from '@limrun/api';

const lim = new Limrun({
  workloadTokenFile: '/var/run/identity/token',
  bindingId: 'binding_REPLACE_WITH_BINDING_ID',
});
const instances = await lim.xcodeInstances.list();
from limrun_api import Limrun

with Limrun(
    workload_token_file="/var/run/identity/token",
    binding_id="binding_REPLACE_WITH_BINDING_ID",
) as lim:
    instances = lim.xcode_instances.list()
client := limrun.NewClient(option.WithWorkloadIdentity(option.WorkloadIdentityOptions{
    TokenFile: "/var/run/identity/token",
    BindingID: "binding_REPLACE_WITH_BINDING_ID",
}))
instances, err := client.XcodeInstances.List(context.Background(), limrun.XcodeInstanceListParams{})

The SDKs cache the exchanged token and renew it before expiry, and concurrent requests share one exchange. AsyncLimrun accepts the same arguments as Limrun. In Go, import github.com/limrun-inc/go-sdk as limrun, its option package, and context. Your identity provider remains responsible for rotating the file. If an exchange fails, the request returns an error before calling the Limrun API.

On Kubernetes, prefer a projected service account token with the audience limrun over the token mounted by default, which is also a credential for your cluster. See Kubernetes.

Pass the JWT directly

When your code already holds the JWT, pass it as a string or as a function that returns the current one:

export LIMRUN_WORKLOAD_IDENTITY_TOKEN="$ID_TOKEN"
export LIMRUN_WORKLOAD_IDENTITY_BINDING_ID=binding_REPLACE_WITH_BINDING_ID
lim whoami
const lim = new Limrun({
  workloadToken: async () => getIdToken(),
  bindingId: 'binding_REPLACE_WITH_BINDING_ID',
});
lim = Limrun(
    workload_token=get_id_token,
    binding_id="binding_REPLACE_WITH_BINDING_ID",
)
client := limrun.NewClient(option.WithWorkloadIdentity(option.WorkloadIdentityOptions{
    TokenSource: func(ctx context.Context) (string, error) { return getIDToken(ctx) },
    BindingID:   "binding_REPLACE_WITH_BINDING_ID",
}))

Here getIdToken, get_id_token, and getIDToken stand for your code that requests a JWT from your identity provider. The SDK calls the function for every exchange, so a long-lived client renews with a fresh JWT. A string is exchanged as is, so once that JWT expires, renewal fails. In the SDKs, pass the string to workloadToken, workload_token, or Token.

Each lim command exchanges the JWT once, so pass a new one to commands that start after it expires.

Use a token your platform injects

Some sandbox platforms never show the JWT to code inside the sandbox. Their egress proxy adds it to outbound requests instead. Configure the proxy to send the JWT to sts.limrun.com in the X-Limrun-Subject-Token header, and set LIMRUN_WORKLOAD_IDENTITY_TOKEN_INJECTED=true in the workload. The CLI and SDK then send the exchange without a JWT, and Limrun reads it from the header. In the SDKs, the option is workloadTokenInjected, workload_token_injected, or TokenInjected.

If the proxy decrypts traffic with its own certificate authority, trust that authority in the workload: Node, and so the CLI and TypeScript SDK, reads NODE_EXTRA_CA_CERTS, and the Python SDK reads SSL_CERT_FILE. The Go SDK uses the system bundle. E2B shows a complete setup.

Check the identity

lim whoami prints the identity, organization, and permissions that Limrun sees, as JSON:

lim whoami

For a federated workload, permissions lists the binding's grants. A failed exchange prints a JSON error on stderr, such as Workload token exchange returned HTTP 400.

Exchange a token with REST

For a client without an SDK, send an RFC 8693 token-exchange request to /v1/access_tokens with Content-Type: application/x-www-form-urlencoded:

curl --fail-with-body https://sts.limrun.com/v1/access_tokens \
  --data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:token-exchange' \
  --data-urlencode 'subject_token_type=urn:ietf:params:oauth:token-type:jwt' \
  --data-urlencode "subject_token=$(cat "$LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE")" \
  --data-urlencode "audience=${LIMRUN_WORKLOAD_IDENTITY_BINDING_ID}"

Existing JSON requests at /v1/access_tokens keep their current request and response formats. JSON object bodies also remain accepted with curl's default form content type. Set Content-Type: application/json in new JSON clients.

To let a proxy supply the JWT, leave out subject_token and have the proxy send the JWT in the X-Limrun-Subject-Token header. A request that carries both returns HTTP 400 with invalid_request. JSON requests ignore the header.

The federation request's audience selects the Limrun binding. The provider's audience field specifies the expected audience inside the external JWT; these values serve different purposes.

The response contains access_token, token_type, issued_token_type, and expires_in. Send access_token in the Authorization Bearer header on Limrun API requests. No refresh token is issued. Exchange the current external JWT again to renew.

Change or revoke access

In Settings, open Workload identity federation. Find the provider's card, then use the pencil icon on a binding to edit its workload condition, permissions, or session duration. Edit a provider to change trust configuration for all its bindings. To stop new exchanges, click the trash icon on a binding and confirm its deletion. Delete all of a provider's bindings before deleting the provider.

Through the API, list bindings with GET /v1/organizations/{organizationId}/federation_bindings. Read, replace, or delete one with GET, PUT, or DELETE on /v1/organizations/{organizationId}/federation_bindings/{bindingId}. A replacement uses the complete configuration body above. Set enabled to false to stop new exchanges without deleting the configuration.

Manage providers with the same methods at /v1/organizations/{organizationId}/federation_providers and /v1/organizations/{organizationId}/federation_providers/{providerId}. Provider updates use the complete provider configuration and require authority over every attached binding's permissions. Deleting a provider that still has bindings returns HTTP 409.

Provider and binding changes take effect on new exchanges after propagation. They do not change permissions in tokens already issued. Each token expires at the earlier of the external JWT's expiry or maxSessionDurationSeconds, which must be between 1 and 14,400 seconds. An issued token can also revoke itself.

Access tokens use the same operation permissions as API keys. Use ios:*:control, android:*:control, xcode:*:control, or gradle:*:control to operate existing instances without managing their lifecycle. Grant create, update, and delete separately when needed; all includes all of them. Default instance tokens grant control on their named instance. Organization, billing, member, and API-key administration still require a member session. To let a workload delegate narrower tokens, include accesstoken:*:all alongside the permissions it can delegate. Derived tokens cannot outlive the presented token.

Issuing long-lived private-tunnel credentials requires an API key or member session with the required tunnel permission. Federated tokens cannot issue them, even with tunnel:*:all.