Repository navigation
ci: harden GitHub Actions workflows - #62
Open
nantoniazzi wants to merge 2 commits into
Open
nantoniazzi wants to merge 2 commits into
nantoniazzi wants to merge 2 commits into
Conversation
A tag can be moved to point at other code if the action repository is compromised. Each action is pinned to the commit its tag points at today, so behavior is unchanged, with the version kept in a comment for Dependabot and readers.
The release job no longer persists the GITHUB_TOKEN in .git/config (semantic-release authenticates through the GITHUB_TOKEN env var) and installs dependencies with --ignore-scripts, so a compromised package cannot run code next to the npm token. No Linux dependency of this package needs an install script; the build still runs explicitly.
nantoniazzi
force-pushed
the
ci/harden-github-actions
branch
from
November 23, 2026 16:12
e002276 to
739a17f
Compare
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.
What
This repository publishes an npm package from GitHub Actions: the
releaseworkflow (started by hand) builds the package and runs semantic-release with theNPM_TOKENandGITHUB_TOKENsecrets. This PR hardens those workflows against a compromised third-party action or dependency, without changing what they do:actions/checkout@fbc6f39… # v5.1.0). Each SHA is the commit the current tag already points to, so behavior is identical..git/configand skips dependency install scripts (persist-credentials: falseon checkout,npm ci --ignore-scripts). The build still runs explicitly, and semantic-release authenticates through theGITHUB_TOKENenvironment variable, as its documentation recommends.Why
CodinGame received a sales email from a CI/CD security vendor pointing at this pattern across our public repositories. An outsider cannot trigger these release workflows: they only run on
workflow_dispatchor on pushes by people with write access, and pull requests from forks run without secrets. The remaining risk is indirect, the same one behind the tj-actions (March 2025) and Shai-Hulud (2025) incidents:.git/configbyactions/checkout, or tamper withnode_modulesbefore semantic-release runs withNPM_TOKEN.Notable decisions
--ignore-scriptsonly in the release job. I checkedpackage-lock.json: no dependency used on Linux needs an install script here (fseventsis macOS only; esbuild 0.19, where present, gets its binary from an optional dependency and works without its script). The PR check job keeps a plainnpm ci, since a pull request from a fork never sees the secrets anyway.NPM_TOKENis still used. The next step is npm trusted publishing (OIDC, no long-lived token), which needs the package to be configured on npmjs.com first; it will come in a follow-up PR.--ignore-scriptsor the missing persisted credentials break something, the job fails before publishing anything, and reverting this commit restores the previous behavior.Evidence
git ls-remote --tagsshowed the moving tag (v5,v4…) and the pinned exact tag resolve to the same commit.