dev: harden the desktop, mobile and docker release workflows - #12995
Open
Totara-thib wants to merge 2 commits into
Open
dev: harden the desktop, mobile and docker release workflows#12995Totara-thib wants to merge 2 commits into
Totara-thib wants to merge 2 commits into
Conversation
The four release workflows run with the keys to every distribution channel, the Apple signing certificates and notary account, the Azure code signing credentials, the Android keystore, the App Store Connect API key, the Flathub workflow token and the Snapcraft store login. All of their third party actions were referenced by version tags, and a tag is a movable pointer, whoever controls the action repo can point it at different code after review. A commit SHA cannot be moved. Each pin keeps the version as a trailing comment so the SHA can be cross checked against the action's releases page. nightly-release already pinned andelf/nightly-release this way, this extends the same practice to the rest of the release surface. Versions stay exactly where they were, nothing is upgraded.
The release workflows ran with the repository's default token grants in every job. Only two jobs actually write through the GitHub token, the nightly and beta release jobs that create releases and upload artifacts, and the docker job that pushes the image to ghcr.io. Those keep contents write and packages write respectively, every other job now runs read only. A compromised step in a build job, whatever its origin, can no longer create releases, push images or touch the repository, the token it sees is read only.
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.
This PR hardens the four workflows that hold the release credentials:
build-desktop-release.yml,build-android.yml,build-ios-release.ymlandbuild-docker.yml. Two commits, nothing about how the builds run changes.Pin the actions by commit SHA. These workflows run with the keys to every distribution channel: the Apple signing certificates and notary account, the Azure code signing credentials, the Android keystore, the App Store Connect API key, the Flathub workflow token and the Snapcraft store login. Their third party actions were referenced by version tags, and a tag is a movable pointer, whoever controls the action repo can point it at different code after the fact. That is exactly what happened in the tj-actions/changed-files incident (CVE-2025-30066), existing tags were rewritten on a popular action to leak CI secrets. A commit SHA cannot be moved. The
nightly-releasejob already pinsandelf/nightly-releasethis way, this extends the same practice to the rest of the release surface. Every version stays exactly where it was, nothing is upgraded, and each pin keeps the version as a trailing comment so the SHA can be cross checked against the action's releases page. Dependabot and Renovate both understand this format and keep updating pinned actions normally if you ever enable one for github-actions.Least privilege tokens. Only three jobs in these workflows write through the GitHub token: the nightly and beta release jobs (create releases, upload artifacts) and the docker job (pushes to ghcr.io). Those keep
contents: writeandpackages: writerespectively, every other job now gets a read only token. A compromised step in a build job can no longer create releases or push images.One heads-up: if the organization ever restricts allowed actions in the repo settings with tag patterns like
owner/action@v4, those patterns stop matching SHA refs and workflows fail at startup. The fix isowner/action@*in that setting. Nothing to do if no such restriction is configured.The other workflows (build, deps-, deploy-) have the same tag references. I scoped this PR to the release surface where the credentials are, happy to follow up with the rest if you want it.
Found and fixed by Plumber's analysis, reviewed and submitted by me.