Mint GitHub tokens for publish through octo-sts instead of a stored PAT - #373
Draft
wallrj wants to merge 1 commit into
Draft
Mint GitHub tokens for publish through octo-sts instead of a stored PAT#373wallrj wants to merge 1 commit into
wallrj wants to merge 1 commit into
Conversation
The v1.21.2 publish failed with 401 from GitHub because the KMS-encrypted GITHUB_TOKEN in gcb/publish/cloudbuild.yaml, a personal access token of the jetstack-release-bot user created in January 2020, had been revoked or had expired. Nobody on the project holds that account's login, so the token could not be rotated. Replace the long-lived token with a short-lived one minted at publish time. When GITHUB_TOKEN is unset and --octo-sts-identity is set, cmrel obtains the Google ID token of the Cloud Build service account from the metadata server, with the octo-sts domain as audience, and exchanges it with octo-sts for a GitHub installation token scoped to the target repository. The trust policy that admits the service account lives in the target repository at .github/chainguard/<identity>.sts.yaml, so each repository controls what the release pipeline may do to it. The octo-sts GitHub App is already installed on every cert-manager org repository. GitHubClient now takes the owner and repo it is for, because octo-sts tokens are scoped to one repository. GITHUB_TOKEN still wins when set, so the existing flow keeps working for anyone who sets it. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Richard Wall <[email protected]>
Contributor
|
Skipping CI for Draft Pull Request. |
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
wallrj
added a commit
to wallrj/cert-manager
that referenced
this pull request
Sep 11, 2026
Lets cmrel gcb publish create the draft GitHub release for a tag with a short-lived token minted by octo-sts from the Cloud Build service account identity, instead of the stored personal access token of jetstack-release-bot that stopped working before v1.21.2 (cert-manager#9237). The octo-sts GitHub App is already installed on this repository. The cmrel side is cert-manager/release#373. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Richard Wall <[email protected]>
This was referenced Sep 11, 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.
cmrel gcb publishno longer needs a stored GitHub token. WhenGITHUB_TOKENis unset and--octo-sts-identityis given, it exchanges the Cloud Build service account's Google ID token with octo-sts for a short-lived GitHub token scoped to the target repository. The KMS-encryptedGITHUB_TOKENis removed fromgcb/publish/cloudbuild.yaml.Why
The v1.21.2 publish failed with 401 from GitHub. The encrypted
GITHUB_TOKENwas a personal access token of thejetstack-release-botuser, created in January 2020 and unchanged since. It was revoked or expired at some point after v1.21.1 on 2026-07-29. Nobody on the project holds that account's login, so the token could not be rotated (cert-manager/cert-manager#9237).A token minted per publish by a service the org already installed removes the secret and the orphaned bot account. The octo-sts GitHub App is installed on every repository in the cert-manager org, but no repository uses it yet.
How it works
cert-manager-release-gcb@cert-manager-release.iam.gserviceaccount.com. The metadata server issues a Google ID token for it with audienceocto-sts.dev.https://octo-sts.dev/sts/exchange?scope=<owner>/<repo>&identity=cmrel-publish..github/chainguard/cmrel-publish.sts.yamlfrom the target repository. If the policy admits the service account, it returns a GitHub installation token with the policy's permissions.GitHubClientnow takes the owner and repository it is for, because each token is scoped to one repository.GITHUB_TOKENstill wins when set.Before this can merge
GITHUB_TOKENfrom the build. This PR then needs a rebase: both touch the same line.jetstack/jetstack-charts. That repository is in the jetstack org, where octo-sts is not installed. Until it is, publish with--publish-actions '*,-helmchartpr'and open the chart PR by hand, or keep settingGITHUB_TOKENfor that repository only.Test plan
go build ./...,go vet ./cmd/cmrel/...,go test ./cmd/cmrel/cmd/pass. The new test covers the request shape, the bearer header, the error body, and an empty response.cmrel publishwith--published-github-org=<fork owner> --publish-actions=githubreleaseagainst a staged release.Not verified: that the hosted octo-sts instance's domain is exactly
octo-sts.dev. The code falls back to the domain as the required audience when the policy sets none, so--octo-sts-domainexists to correct it without a code change.[Claude Fable 5.1]