Skip to content

dev: harden the desktop, mobile and docker release workflows - #12995

Open
Totara-thib wants to merge 2 commits into
logseq:masterfrom
Totara-thib:ci-hardening
Open

dev: harden the desktop, mobile and docker release workflows#12995
Totara-thib wants to merge 2 commits into
logseq:masterfrom
Totara-thib:ci-hardening

Conversation

@Totara-thib

Copy link
Copy Markdown

This PR hardens the four workflows that hold the release credentials: build-desktop-release.yml, build-android.yml, build-ios-release.yml and build-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-release job already pins andelf/nightly-release this 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: write and packages: write respectively, 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 is owner/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.

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.
@CLAassistant

CLAassistant commented Aug 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants