Skip to content

ci: verify the mise installer before publishing and scope the check build token - #841

Open
Totara-thib wants to merge 4 commits into
CodinGame:mainfrom
Totara-thib:ci/verify-mise-installer
Open

Totara-thib wants to merge 4 commits into
CodinGame:mainfrom
Totara-thib:ci/verify-mise-installer

Conversation

@Totara-thib

Copy link
Copy Markdown

Hello there, 4 CI hardening contributions:

  • Release and Check build install mise with curl https://mise.run | sh, run unchecked. Both now check the SHA-256 of install.sh from the mise v2026.11.12 release before running it: the same script and mise as your last release, fixed until those lines change.
  • check_build.yml declared no permissions: now contents: read, plus the four scopes the Netlify preview uses.
  • The checkouts stop keeping the job token, semantic-release pushes with its own.
  • actions.lock, GitHub's workflow dependency lockfile from gh actions-lock, records the commit behind each action, which followed movable tags. Refs become exact versions, same commits as today.

A changed installer or moved tag runs with what its job holds (the tj-actions incident, CVE-2025-30066), here the identity publishing 188 npm packages.

Your ci/harden-github-actions branch pins the same commits, and a lockfile needs gh actions-lock after every bump: say so and I rebase on that branch without it.

Check build runs the new install lines here, release.yml only at release. An allowed-actions policy listing tags needs owner/action@*.

Found and fixed with Plumber (C 52/100 before, up to A 100/100 after), reviewed and submitted by me.

The Release job and the Check build job both ran `curl https://mise.run | sh`. Whatever that
URL serves runs in the Release job before `npm publish`, with the token that publishes the
packages and writes to the repository, and in Check build next to the Netlify token.

Both jobs now download install.sh from the mise v2026.11.12 release, check its SHA-256 and
run it with MISE_VERSION set to that release. It is the script mise.run serves today (same
checksum) and the mise the last Release run installed, at the same path, so the two PATH
lines and the two `mise install` commands are unchanged.

mise stays at 2026.11.12 until the version and the checksum are changed in both files.
check_build.yml declared no permissions, so on a pull request from a branch of this
repository both jobs ran with the default token, which can write everywhere.

The workflow now defaults to `contents: read`, which is all Lint commits needs. Check build
keeps the four scopes its Netlify preview step uses through `github-token`: the commit
comment, the pull request comment, the deployment and the commit status. The release dry
run stops before it uses the token on a pull request.

Pull requests from forks already ran read-only and skip the preview step.
actions/checkout keeps the job token in the git configuration for the rest of the job
unless `persist-credentials: false` is set. In Release that token can write to the
repository and it stayed readable by the build, the publish and the Netlify steps.

Nothing relies on it. commitlint only reads the local history, the builds fetch VSCode and
monaco-editor as tarballs, and semantic-release pushes the tag to a URL that carries the
GITHUB_TOKEN of its own step.
The workflows referenced their actions by tags that can be moved: `actions/checkout@v7`,
`jdx/mise-action@v4`, `nwtgck/actions-netlify@v4.0` and `@v3.0`, `actions/stale@v8`.

`gh actions-lock` writes .github/workflows/actions.lock, GitHub's workflow dependency
lockfile, with the commit each action resolves to, and narrows each ref to the exact
version behind it. The five commits are the ones the tags point to today and the ones the
last runs used. Once the file exists a workflow only runs the commits recorded in it.

After a change to a `uses:` line, run `gh actions-lock` again and commit the result.

This branch has not been deployed

No deployments
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.

1 participant