docs: Mention immutable subject claims #1787
@jmeridth could you take a look at this PR?
:robot: (medium)
Thanks for writing this up! I think immutable subjects still break on rename, because the subject keeps the owner and repo names next to the IDs (repo:chainguard-dev@87436699/foo@123456789). Matching repository_id or using repository_ids survives a rename, but an exact subject doesn't. What do you think about dropping "Using immutable subject claims, as above" from this sentence?
:robot: (medium)
Existing repos keep the name-only subject unless someone opts in, so a copied example like this one won't match their tokens. Could the immutable subject go in as a second example next to the current one? This org example also used to show subject_pattern with a repository_id claim across the org, which seems worth keeping.
:robot: (medium)
Some more context: per GitHub's changelog, only repos created, renamed or transferred after July 15, 2026 get the immutable subject by default, and older repos keep repo:owner/name:... until someone opts in. The same applies to the examples at lines 70 and 502. A copied policy fails closed rather than opening access, but users of older repos would see token exchanges fail with no obvious reason. Would it make sense to show both forms and note which repos emit which?
@jmeridth could you take a look at this PR?
@pavelzw @cpanato beat me to it 😄.
@jmeridth could you take another look?
:robot: (low, non-blocking)
Turning the setting on for an existing repo switches its tokens to the immutable subject right away, so any name-only policy stops matching until it's updated. Maybe worth saying so here, since this bullet is what people skim?
- **Use immutable subject claims**: For GitHub Actions, enable [immutable subject claims](https://docs.github.com/en/actions/reference/security/oidc#immutable-subject-claims) so a policy cannot be satisfied by a different repository or organization that reuses the same name. On an existing repository, update its trust policies to the immutable subject at the same time, since tokens stop matching name-only subjects once the setting is on.
:robot: (summary)
LGTM, thanks for reworking this. Keeping the name-only examples and adding the immutable form next to them reads well, and cpanato's two points look covered by 9d2764d. One small note inline on the best-practices bullet.
:robot: (summary)
Thanks for applying the suggestion. LGTM.
jmeridth
pavelzw
a couple of months ago, github introduced immutable subject claims: https://github.blog/changelog/2026-04-23-immutable-subject-claims-for-github-actions-oidc-tokens/
we should adjust the readme to use those as they are the new default.