Repository navigation
fix(gcb): rotate the publish GITHUB_TOKEN - #372
Conversation
The v1.21.2 publish job failed with `401 Bad credentials` when creating the draft GitHub release. The encrypted token in this file had not changed since 2020-01-31, and was revoked some time after the v1.21.1 publish succeeded on 2026-07-29. Replace it with a fine-grained token for the cert-manager-bot account, encrypted with the same KMS key. `gcb/test/helm/cloudbuild.yaml` still holds the old, revoked blob. It targets jetstack/jetstack-charts, which a fine-grained token scoped to the cert-manager organisation cannot reach, so it needs a separate credential and is left alone here. Signed-off-by: Richard Wall <[email protected]>
|
/hold |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: erikgb The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Thanks for the review @erikgb. This token is no longer theoretical — v1.21.2 was published with it: https://github.com/cert-manager/cert-manager/releases/tag/v1.21.2 The clearest evidence that the rotation took effect is the release author. Every release up to and including v1.21.1 was created by
The publish ran with Worth recording for whoever looks at this next: the account itself was never the problem. /unhold |
What this does
Rotates the KMS-encrypted
GITHUB_TOKENused by the publish job.This is a stop-gap. It swaps one long-lived credential for another so that v1.21.2 can ship. It does not fix the underlying problem, which is that the privileged publish job depends on a static token that nobody notices has died until a release fails. Separately I am looking at octo-sts so that the job mints short-lived, federated credentials and we hold no long-lived access tokens at all. Treat this PR as buying time for that work, not as the answer.
Why now?
The v1.21.2 publish failed. The job got as far as the first publish action and stopped:
Tracing the token line with
git log -Lshows the encrypted blob had not changed since 2020-01-31. It last worked for the v1.21.1 publish on 2026-07-29, so it was revoked at some point in the six weeks since.401means the credential is invalid, not that a scope is missing.A token that sat untouched for five and a half years, and whose death we discovered through a failed release, is a good illustration of why the octo-sts work is worth doing.
The replacement is a fine-grained token for the
cert-manager-botaccount, encrypted with the same KMS key.One thing reviewers should know
A fine-grained token has a single resource owner, so this one cannot reach
jetstack/jetstack-charts. The publish job has three actions, and they run in this order:githubreleasecert-manager/cert-managerhelmchartprjetstack/jetstack-chartspushcontainerimagesquay.io/jetstack(usesDOCKER_CONFIG)So v1.21.2 will be published with
--publish-actions '*,-helmchartpr'and the chart PR raised by hand. The cross-org problem is one of the things octo-sts should settle properly.Test evidence
No release was published by the failed run, so this is a clean retry rather than a repair. Verified three ways:
Checks confirming nothing reached the public repositories
v1.21.2release oncert-manager/cert-managerv1.21.2tag onquay.io/jetstack/cert-manager-controller(the same query returnsv1.21.1, so it is not a false negative)jetstack/jetstack-charts; the newest is #559 from AugustThe container images in the build log were only
docker loaded into the build's local daemon. They were never pushed.The new ciphertext decodes as valid base64 (175 bytes) and carries the same KMS key handle prefix as the value it replaces. The file still parses as YAML with both
GITHUB_TOKENandDOCKER_CONFIGpresent.DOCKER_CONFIGis untouched.Final proof is the publish itself, which I will run from this commit.
Left alone deliberately
gcb/test/helm/cloudbuild.yamlholds the same revoked blob. It targetsjetstack/jetstack-charts, so it needs a credential this token cannot provide. Rotating it needs a separate decision and I did not want to hide that inside a release fix.