GitHub Actions
Workflows authenticate with the repository and ref they ran from.
Workflows authenticate with the repository and ref they ran from.
What proves the identity
The token has to come from https://token.actions.githubusercontent.com, and its sub claim has to match the workload you named. penv compares that claim byte for byte, with no wildcards.
Every token also has to name your workspace as its audience. Ask for this audience and no other. A token requested for two audiences fails every exchange.
What the console asks for
A repository, then the project and environment this identity reaches, the role it gets, and whether a branch or a GitHub environment may authenticate. The subject is read from GitHub rather than typed, so no form asks for one.
What the trust holds
For the repository you pick:
| What | Value |
|---|---|
| Issuer | https://token.actions.githubusercontent.com |
| Claim compared | sub |
| Subject | read from the platform rather than built from a form |
| Identity name | built from the repository as well |
penv names the identity for you, so the form never asks for one.
The snippet the console prints
permissions:
id-token: write # without this, no token is issued at all
steps:
- run: |
T=$(curl -sS \
-H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=YOUR_WORKSPACE_ID" | jq -r .value)
C=$(curl -sS "https://penv.cloud/api/v1/auth/oidc" \
-H 'content-type: application/json' \
-d "{\"token\":\"$T\"}" | jq -r .credential)
PENV_TOKEN="$C" penv pullThe snippet finishes with penv pull, which writes a file. penv run is the path the docs teach for a process, and penv pull is for a host that needs a file on disk. Connect your CI has the wrapped step.
Related
- Machine identity
- Connect a Platform in the console
- GitHub Actions
- GitHub Actions documentation, where the value people get wrong is always the subject