OIDC identity
A step granted identity: {audience: ...} gets a short-lived token signed by the server, which AWS, GCP, Azure and Vault trust instead of a stored key. It needs the secrets key above: the signing key is stored encrypted with it, made when the server first starts with one.
The issuer and the token
- Each org has its own issuer:
<HOD_OIDC_ISSUER_URL>/oidc/<org ID>, with the discovery document at.../.well-known/openid-configurationand the keys at.../jwks. The server logs it at startup. Copy it exactly, with no trailing slash: clouds compare it byte for byte. - Clouds must reach it over https, with a certificate from a public CA. A server they can't reach can host the two files elsewhere: set
HOD_OIDC_ISSUER_URL(oroidc.issuer_url) to, for example,https://hod-oidc.s3.amazonaws.com, runhod-server oidc export DIR, and uploadDIR/oidc/there, served asapplication/json. GCP can take the JWKS file instead (--jwk-json-path), and Vault the keys themselves (jwt_validation_pubkeys). - The token is RS256, lives 5 minutes, and is refreshed while the step runs. Its
subisorg:<org>@<org ID>:project:<project>@<project ID>:ref:<ref>, so a renamed or recreated project can't match a policy written for the old one. Its other claims:org,org_id,project,project_id,ref,ref_type,sha,event,is_default_branch,run_id,run_number,run_attempt,job,job_attempt,step. Runs from forks get no token. - Never trust the issuer alone. A trust policy must check
audandsub; one that checks only the issuer lets every project of the org in. Most OIDC incidents in CI were policies like that. - Rotating the signing key:
hod-server oidc rotate-keypublishes the next key at once and signs with it 24 hours later; the old key leaves the JWKS an hour after that. Keys uploaded to GCP, pasted into Vault, or exported must be updated within those 24 hours.--nowis for a leaked key: the new key signs at once and the old one is gone, so tokens it signed stop working. Rotating the secrets key (hod-server rotate-key) rewraps signing keys too. Signing keys never stop the server from starting: if the secrets key they were sealed with is gone, the server makes a new signing key and warns, and pasted or uploaded keys must be updated. - Every token is audited in
identity_releases: job, attempt, step, grant, audience,jtiand key.
AWS
An IAM OIDC provider for the issuer, audience sts.amazonaws.com. The step sets AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE="$HOD_IDENTITY_TOKEN_FILE", which the AWS CLI and SDKs read. The role's trust policy:
GCP
A workload identity pool provider for the issuer. GCP refuses a mapped google.subject over 127 bytes, which a full sub with its IDs often is, so map shorter claims and check the rest in the condition:
Azure
A federated identity credential on an app registration. Azure matches iss, sub and aud exactly:
Vault
JWT auth, with vault write auth/jwt/login role=web-main jwt=@"$HOD_IDENTITY_TOKEN_FILE" in the step:
Registries' trusted publishing (npm, PyPI, crates.io) and Sigstore's keyless signing trust only a list of hosted CI issuers, so a self-hosted Hod's tokens don't reach them: use a stored secret.