For AI agents: the complete documentation index is available at https://docs.hod.sh/llms.txt, the full documentation bundle is available at https://docs.hod.sh/llms-full.txt, and this page is available as Markdown at https://docs.hod.sh/self-hosting/oidc.md.

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-configuration and 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 (or oidc.issuer_url) to, for example, https://hod-oidc.s3.amazonaws.com, run hod-server oidc export DIR, and upload DIR/oidc/ there, served as application/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 sub is org:<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 aud and sub; 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-key publishes 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. --now is 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, jti and 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:

{
  "Effect": "Allow",
  "Principal": { "Federated": "arn:aws:iam::123456789012:oidc-provider/hod.example.com/oidc/<org ID>" },
  "Action": "sts:AssumeRoleWithWebIdentity",
  "Condition": {
    "StringEquals": {
      "hod.example.com/oidc/<org ID>:aud": "sts.amazonaws.com",
      "hod.example.com/oidc/<org ID>:sub": "org:acme@<org ID>:project:web@<project ID>:ref:refs/heads/main"
    }
  }
}

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:

gcloud iam workload-identity-pools providers create-oidc hod \
  --location=global --workload-identity-pool=hod \
  --issuer-uri="https://hod.example.com/oidc/<org ID>" \
  --attribute-mapping="google.subject=assertion.project_id + ':' + assertion.ref,attribute.project_id=assertion.project_id,attribute.ref=assertion.ref" \
  --attribute-condition="assertion.org_id == '<org ID>' && assertion.project_id == '<project ID>' && assertion.ref == 'refs/heads/main'"

Azure

A federated identity credential on an app registration. Azure matches iss, sub and aud exactly:

{
  "name": "hod-web-main",
  "issuer": "https://hod.example.com/oidc/<org ID>",
  "subject": "org:acme@<org ID>:project:web@<project ID>:ref:refs/heads/main",
  "audiences": ["api://AzureADTokenExchange"]
}

Vault

JWT auth, with vault write auth/jwt/login role=web-main jwt=@"$HOD_IDENTITY_TOKEN_FILE" in the step:

vault auth enable jwt
vault write auth/jwt/config oidc_discovery_url="https://hod.example.com/oidc/<org ID>" \
  bound_issuer="https://hod.example.com/oidc/<org ID>"
vault write auth/jwt/role/web-main role_type=jwt user_claim=sub token_ttl=15m \
  bound_audiences=vault token_policies=deploy \
  bound_subject="org:acme@<org ID>:project:web@<project ID>:ref:refs/heads/main"

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.