fix(ci): correct release trust policy for environment-scoped subject#515
Merged
Conversation
The release job in release-prepare.yml uses `environment: release`, which rewrites the OIDC subject to `repo:DataDog/pup:environment:release` instead of the ref-based form. Also fix casing — claim regex matching is case-sensitive and GitHub preserves `DataDog/pup` in claims. The `release` environment has a required-reviewer protection rule, which appropriately gates the `contents: write` permission grant. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
platinummonkey
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Prepare Releaseworkflow has been failing with403 permission deniedduring dd-octo-sts token exchange (e.g. run 26134581691). Two issues in.github/chainguard/release.sts.yaml:releasejob declaresenvironment: release, which causes GitHub Actions to rewrite the OIDCsubclaim torepo:DataDog/pup:environment:releaseinstead of the ref-based form. The policy was matching on the ref-based subject.datadog/pupbut GitHub preservesDataDog/pupin claims likerepositoryandjob_workflow_ref.Changes
.github/chainguard/release.sts.yaml— subject changed torepo:DataDog/pup:environment:release; fixed casing ofrepositoryandjob_workflow_refpatterns.Security
The
contents: writepermission is now scoped to thereleaseenvironment subject. That environment has a required-reviewer protection rule (verified viagh api repos/DataDog/pup/environments/release), so the privileged permission grant is gated by environment protection — consistent with dd-octo-sts guidance on restricting privileged permissions to protected refs/environments.Test plan
mainso dd-octo-sts can pick up the new policy (policies are read from the default branch).Prepare Releasejob (or wait for the next scheduled run) and confirm token exchange succeeds.🤖 Generated with Claude Code