Sub topic 3
GitHub Actions as an identity provider
This chapter assumes you know basic workflow syntax, what a JWT is (covered in the previous chapter), and the general idea of cloud IAM roles. It explains what it means for GitHub to act as an identity provider, and what a cloud provider needs to know to trust it.
The roles in the exchange
In OpenID Connect (OIDC), an identity provider (IdP) signs statements about who someone is. A relying party checks those statements and decides what to allow. For a workflow, the roles map like this:
| Role | Who plays it |
|---|---|
| Identity provider | GitHub, at `https://token.actions.githubusercontent.com` |
| Subject being identified | A single workflow job run |
| Relying party | Your cloud provider (AWS, Azure, Google Cloud, Vault) |
GitHub does not log anyone in here. It mints a signed JWT for each job that asks for one. The token says which repository, branch, and workflow the job belongs to. The cloud provider never talks to your runner. It only checks the token's signature and claims.
What GitHub publishes
The cloud provider needs to verify signatures without a shared secret. GitHub makes this possible by publishing two public documents under its issuer URL:
- A discovery document at
/.well-known/openid-configuration. It lists the issuer name, the signing algorithms, and where the keys live. - A JSON Web Key Set (JWKS), a list of public keys. The discovery document points to it with the
jwks_urifield.
You can read both yourself:
curl -sS https://token.actions.githubusercontent.com/.well-known/openid-configuration \
| jq '{issuer, jwks_uri, id_token_signing_alg_values_supported}'The issuer value is exactly the string that appears in the iss claim of every token. When you register GitHub as a provider in your cloud account, you are telling that cloud to trust tokens that carry this issuer and are signed by keys from this JWKS.
One token per job, on demand
GitHub does not put a token in your job automatically. When the workflow grants the right permission (the next chapter covers id-token: write), the runner receives two environment variables:
ACTIONS_ID_TOKEN_REQUEST_URL, the endpoint to call.ACTIONS_ID_TOKEN_REQUEST_TOKEN, a bearer token that authorizes the call.
A step calls the endpoint, and GitHub signs a fresh JWT describing that job. The token is short-lived, so a leaked copy becomes useless quickly. Each job gets its own tokens, and nothing is stored in repository settings.
The cloud provider usually fetches and caches the keys itself. It does not need a request for each job.
Why this design is safer
With stored secrets, the cloud trusts whoever holds a key. With OIDC, the cloud trusts GitHub's statement about a specific job, and you decide which statements to accept. The decision lives in the cloud's trust policy, which a later chapter covers. GitHub only supplies the evidence.
One consequence matters in practice. GitHub signs tokens for every repository on github.com with the same issuer and keys. A valid signature therefore proves only that GitHub issued the token. It does not prove the token belongs to your repository. Your trust policy must check the claims.
Exercise
A teammate says, "The token's signature is valid, so the cloud can safely let this job deploy to our account." What is missing from this reasoning?
Show answer
GitHub signs tokens for all repositories with the same keys, so a valid signature only proves GitHub issued the token. The cloud must also check claims such as the audience and the subject to confirm the token comes from your repository and branch.