Repository navigation
Conversation
workload_token takes a JWT or a callable that returns the current one; the async client also accepts an async callable. The callable runs for every exchange, so long-lived clients renew with a fresh JWT. LIMRUN_WORKLOAD_IDENTITY_TOKEN does the same from the environment. Explicit options win over environment variables, and a token over a file. Matches the TypeScript and Go SDKs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
workload_token_injected and LIMRUN_WORKLOAD_IDENTITY_TOKEN_INJECTED send the federation exchange without subject_token, so a proxy can supply the JWT in the X-Limrun-Subject-Token header for workloads that never see it. Matches the TypeScript and Go SDKs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
copy() and with_options() forwarded the current injected flag alongside any new token or file, so switching sources raised the combination error, and enabling injection could not drop a token or file. A source passed to copy() now replaces the current one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 06d1956. Configure here.
| ) -> Tuple[Optional[_Token], Optional[str], bool]: | ||
| """A source passed to copy() replaces the client's current one rather than combining with it.""" | ||
| if token or token_file or injected: | ||
| return token, token_file, bool(injected) |
There was a problem hiding this comment.
Copy to injected restores env sources
Medium Severity
When with_options() switches a client to workload_token_injected, replace_identity clears the token and file by returning None. The copied client constructor treats those as unset and reloads LIMRUN_WORKLOAD_IDENTITY_TOKEN or LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE, so the switch raises a combined-source error whenever those environment variables are set.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 06d1956. Configure here.


Note
High Risk
Introduces a second authentication path on every SDK request and STS token exchange; misconfiguration or exchange bugs could break auth broadly, though API keys still take precedence when set.
Overview
Adds workload identity federation as an alternative to API keys:
LimrunandAsyncLimrunaccept JWT sources (workload_token,workload_token_file, or proxy injected mode viaworkload_token_injected) plusbinding_idand optionalLIMRUN_STS_BASE_URL, with matching environment variables. When no API key is configured, requests get a cached Bearer token from OAuth token exchange against STS/v1/access_tokens.New
_workload_identitymodule handles exchange, refresh, concurrency-safe caching, and sync/async callables. Clientcopy/with_optionscan switch identity sources while reusing the same exchange object when federation settings are unchanged. README documents setup (including K8s projected tokens and egress-proxy JWT injection) and clarifies instance control tokens vs lifecycle credentials.Extensive tests cover rotation, concurrent refresh, precedence, validation, and failure behavior before any API call runs.
Reviewed by Cursor Bugbot for commit 06d1956. Bugbot is set up for automated code reviews on this repo. Configure here.