Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,10 @@ jobs:
needs.release-seal.result == 'success'))
runs-on: ubuntu-latest
permissions:
contents: read
# GitHub hides drafts from contents:read tokens. This short-lived,
# repository-scoped token can inspect the sealed draft without exposing
# the organization credential used by release publication and automerge.
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
Expand Down
6 changes: 5 additions & 1 deletion tests/releasecontrol/release_control_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,15 @@ func TestReleaseToolingIsPinnedAndPermissionsAreLeastPrivilege(t *testing.T) {
requireContains(t, signer, "id-token: write", path)
requireContains(t, signer, `gh release upload "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY"`, path)
// 5 references: the admission presence check, the three immutable-release
// gates, and the admission draft read (which uses CI_GITHUB_TOKEN because the
// gates, and the admission draft read (which use CI_GITHUB_TOKEN because the
// built-in token is contents: read and cannot see draft releases).
if got := strings.Count(workflow, "secrets.CI_GITHUB_TOKEN"); got != 5 {
t.Errorf("%s CI_GITHUB_TOKEN secret references = %d, want 5", path, got)
}
verify := requireWorkflowJob(t, workflow, "verify-sealed-release", path)
requireContains(t, verify, "contents: write", path)
requireContains(t, verify, "RELEASE_GH_TOKEN: ${{ github.token }}", path)
requireNotContains(t, verify, "secrets.CI_GITHUB_TOKEN", path)
requireNotContains(t, workflow, "\nenv:\n CI_GITHUB_TOKEN:", path)

const cdPath = ".github/workflows/cd.yml"
Expand Down