How does GitHub OIDC work, end to end?
IntermediateConceptOIDC & Security Hardening
Answer
- The job has
permissions: id-token: write, so the runner getsACTIONS_ID_TOKEN_REQUEST_URLandACTIONS_ID_TOKEN_REQUEST_TOKEN. - An action requests a JWT from
https://token.actions.githubusercontent.comwith an audience. - GitHub signs a token with claims:
iss,aud,sub,repository,ref,environment,job_workflow_ref,run_id,actor, and more; valid for minutes. - The cloud provider validates signature and claims against a configured identity provider and trust conditions.
- It returns short-lived credentials (AWS STS, Azure AD, GCP STS) scoped to a role.
No long-lived keys exist in GitHub, and stolen tokens expire quickly.
More on OIDC & Security Hardening
What are the `sub` claim formats, and which do you put in an AWS trust policy?AdvancedConfigure OIDC to AWS: provider, role and workflow.AdvancedConfigure OIDC to Azure.AdvancedConfigure OIDC to GCP.AdvancedWhy pin actions to a full commit SHA, and how do you keep pins updated?IntermediateWhat is script injection, and how do you fix it?Advanced