9. Identity¶
This section covers who the workloads are in Azure and how they prove it: the analyzer (9.1), the executor and its GitHub App key (9.2), the workload identity wiring (9.3), how Key Vault signing fails and retries (9.4) and the Go side (9.5). Edge cases and numbers are in the table "Details" at the end (9.6).
The rule for everything below: no PATs, no client secrets, no long-lived API keys, except a static credential under the conditions of invariant 6 ("Static credentials" in AGENTS.md) where the external service offers no keyless authentication. In use today: the analyzer's Anthropic API key (ADR-0037). The optional OpenAI-compatible key is separately mounted and endpoint-bound (ADR-0042). Tokens for Foundry, Key Vault and GitHub are never interchangeable, and the Anthropic key goes only to api.anthropic.com.
9.1. Analyzer¶
What it does. The analyzer has its own managed identity. It holds only the inference role on the model deployment, and permission to create blobs in the analysis records container (ADR-0015). It asks Entra ID for a token of the Cognitive Services audience for the model, only when a Foundry deployment can be configured (--model-endpoint-suffixes set and --disable-foundry false), and, only with a record store configured, one of the Storage audience for the records (internal/providers/store/azureblob, azidentity's workload identity credential).
In the cluster its ServiceAccount is read-only (2.2.2, the full list in Configuration). Of the RemediationPolicies it may only get the ones --action-policies names, by resourceNames (no list or watch, no rule without a name), so the context can show the model the bounds of the policy that will decide its proposal (3.3, #493). Reading a policy decides nothing: the executor reads it again and decides (invariant 1).
built (#537) It also reads the reviewer hints the executor stored in request status (ADR-0028), never the pull request comment itself, and writes nothing new for them (its replacement request is the create it already has): it cannot write request status, so it cannot forge a hint. It records the ID of the hint it handled in the Incident status it already writes (status.handledHint), and the executor's get on that Incident reads the Analyzed condition and that ID to learn a refusal (built, #538, code merged, off by default, opt-in with --reviewer-hints (#631); the analyzer reads the condition to decide nothing).
built (#729) For a deployment with provider: Anthropic the analyzer authenticates with an API key instead of a token: it reads the file of --anthropic-api-key-file at every call, a read-only mount from a Secret or a CSI volume the cluster operator provides, never an environment variable or a field of a custom resource. It gets no RBAC on Secrets for it; the kubelet or the CSI driver mounts the file. Since #814 the workload identity is needed only with --model-endpoint-suffixes (a Foundry deployment) or a record store: an analyzer whose deployments are all Anthropic runs without it and builds no Azure token source.
Why. The analyzer talks to a model and writes records.
Limits. The token audience must match the endpoint. The deployed role can still overwrite the records, so the adapter sends every write with If-None-Match: *: Blob Storage then refuses to replace an existing blob (409 or 412), and the adapter never retries that answer. That protects against the analyzer's own mistakes, not against a stolen token, which can still send a write without the header. A try that reaches its own 10 second timeout is retried within the write's 30 seconds, also when an answer arrives only after that timeout. Of such late answers only 201 Created counts, as a success; any other decides nothing, and a blob that try did store answers the retry with 409 BlobAlreadyExists, which the analyzer records as its own record (its IDs are unique per run). When the last try ends with no answer that counts, the write fails as retryable and the record may be stored without its ID in the Incident status. Versioning is the recovery evidence until #154 makes the role create-only (planned).
9.2. Executor and the GitHub App key¶
What it does. The executor has its own managed identity. It may only sign with one Key Vault key. The GitHub App private key is imported into Key Vault as a non-exportable key. The executor signs the App JWT through Key Vault and exchanges it for a one-hour installation token.
Why. The private key never exists in the pod or in a Kubernetes Secret (ADR-0006). A compromised pod cannot copy the key out, but while it runs it can still sign with it (threat model).
built (off by default, opt-in with the executor flag --reviewer-hints, #631) The same identity and token serve the reviewer hints of ADR-0028 for the code host. An integration other than the code host gets no access to this key: it belongs to a future shadewright-coordinator with its own credentials.
The JWT and the token.
- The JWT is issued 60 seconds in the past and lives 10 minutes in total.
- The token request names the one repository and the five permissions of section 8.4 (the fifth,
checks: write, for the merge gate of reviewer hints, ADR-0028, since #539; GitHub refuses a token request that names a permission the App lacks). - The response is refused unless it lists exactly that repository.
- The token is cached until 5 minutes before it expires, and concurrent callers share one refresh.
- The App's numeric ID is read once per provider with
GET /appunder a JWT of its own, so one more Key Vault signature (KeySign), and then kept, since an App's ID never changes (#542). It is read the first time the executor comments on a pull request, before it looks for the comment's marker: only a comment the App's bot user posted (performed_via_github_app.idequal to that ID) counts, so a person cannot paste a marker to suppress a comment. When the read fails, nothing is posted. - The token prints as a placeholder, never as its value (
internal/providers/github/auth).
9.2.1. The verifier has no Azure identity¶
The verifier (shadewright-verifier, #682) is the third ServiceAccount. It has no managed identity, no federated credential and no annotation for one: it calls no model, signs nothing and never reaches Azure. Its grants are Kubernetes RBAC only (2.2.4).
9.3. Workload identity wiring¶
What it does. Federated credentials use subject system:serviceaccount:<namespace>:<serviceaccount> and audience api://AzureADTokenExchange (AKS workload identity). With config/ the executor's subject is system:serviceaccount:shadewright-system:shadewright-executor (the lab default since shadewright-azure#7).
What the pod needs.
- The executor pod carries the label
azure.workload.identity/use: "true". - Its ServiceAccount carries the annotation
azure.workload.identity/client-idwith the executor identity's client ID. Inconfig/this is a placeholder that the deployer sets.
What can go wrong: missing label or annotation. Without them the executor cannot sign, and every repository open fails as a transient error. It is retried with backoff, so requests wait in their phase and the log shows the failure.
What can go wrong: unusable repository settings. The repository settings are validated before the signer is built. An entry the adapter refuses is reported as RepositoryUnusable and is not retried.
9.4. Signing through Key Vault: deadlines and retries¶
What it does. A sign call through Key Vault (internal/providers/signer/azurekv) has a 30-second deadline, or the caller's if that is shorter. Each try has a 10-second deadline. Within the deadline, failures that look temporary are retried up to 3 times with exponential backoff and jitter.
Retried (transient):
- throttling and transient server errors;
- network failures: TLS alerts from the server, a closed idle connection, HTTP/2 GOAWAY or stream resets, and any HTTP client error not known to be local;
- a response body that breaks off.
Reported as transient, so the caller retries later:
- what is still failing after the 3 retries;
- a token request that gets no answer from Entra ID;
- a token request that gets a successful answer that cannot be used;
- a token request that runs into the per-try deadline;
- a response from Key Vault or Entra ID that the HTTP client hands back only after the try's deadline has passed, whatever its status, Key Vault challenge or declared size: nothing of it is checked before the deadline is (#447, #781);
- a response whose body was still being read when the try's deadline passed (#447), unless more than 64 KiB of it had arrived by then, which is final.
Final (reported as permanent; the caller does not retry):
- a certificate the client refuses, from Key Vault or Entra ID;
- an https request answered in plain HTTP;
- a token request Entra ID refuses;
- a federated token file that cannot be read (see 9.6);
- a token failure the signer cannot see into, from a credential it did not build;
- a Key Vault challenge the SDK cannot parse safely, or a response body larger than 64 KiB, when the response arrives before the deadline;
- a caller that cancels, also when a response arrives after the cancellation (#781).
Limits. When Entra ID's answer reaches the signer before the try's deadline, its status decides, even if the deadline passes before the token request returns, unless the caller cancelled. Errors keep only fixed text, the status code and the class.
9.5. In Go¶
What it does. Workload identity goes through azidentity (or a deliberately configured DefaultAzureCredential).
How the signer does it. The Key Vault signer builds azidentity.ClientAssertionCredential with the same tenant, client ID and authority host as WorkloadIdentityCredential. It reads the federated token file itself and sends its token requests through its own HTTP transport. That way it knows when the file, or the connection to Entra ID, is the failure.
9.6. Details¶
| Topic | Detail |
|---|---|
| Installation token | One hour; checked to list only the one repository; requests the five permissions of section 8.4 |
| JWT | Issued 60 seconds in the past, 10 minutes in total |
| Token cache | Until 5 minutes before expiry; one shared refresh |
| Sign call deadline | 30 seconds, or the caller's if shorter; 10 seconds per try |
| Sign retries | Up to 3, exponential backoff with jitter |
| Federated token file, final failures | Missing also after one retry 50 ms later, not a regular file, empty, or larger than 64 KiB |
| Analysis records role | Can overwrite until #154; versioning is the recovery evidence |
OpenAI-compatible key and Service access¶
Only the analyzer mounts the optional compatible key. The provider has no Entra
token source and never receives the Anthropic key. With --disable-foundry and
no Blob record store, a compatible-only analyzer needs no Azure identity. A key
is read per attempt and bound to its exact declared base in
--openai-compatible-endpoints. Each declaration also names the allowed models;
settings cannot route that key through an undeclared model alias. Redirects are refused. Exact Service DNS names may be granted private-address access at
install time, still over verified HTTPS. No RBAC changes. See
identity and rotation.