security(ci): pin third-party GitHub Actions to commit SHAs#801
Merged
Conversation
`uses: action@v1` style references resolve to whatever commit the tag currently points at. Tag ownership is shared with the action maintainer, so a compromise of their account (or a malicious maintainer move) can silently rewrite the tag to point at a hostile commit without any change to our workflow files. The industry-standard mitigation is to pin every non-trusted action to a full commit SHA and keep the semver as a trailing comment for humans. Pin the two third-party actions used in Craft's workflows: - pnpm/action-setup@b906aff # v4.3.0 (build.yml x3, docs-preview.yml x1, lint.yml x1) - rossjrw/pr-preview-action@ffa7509 # v1.8.1 (docs-preview.yml x1) Left unpinned by design: - actions/* (GitHub-owned; trust root). - getsentry/* (same org; separate trust boundary from third-party). - Local ./ and local reusable workflows (path-based, no tag drift). getsentry/action-enforce-license-compliance was already SHA-pinned.
Contributor
|
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 93befdb. Configure here.
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.

Summary
Pins every third-party GitHub Action used in Craft's own CI to a full commit SHA, with the semver retained as a trailing comment for human reviewers. Protects against tag-hijacking (compromised maintainer account, malicious force-push to a tag, or an intentional-turned-hostile maintainer) without losing the readability of "what version am I on?" at a glance.
Changes
Two third-party actions touched, 6 usages total across 3 workflow files:
pnpm/action-setup@v4@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0rossjrw/pr-preview-action@v1@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1.8.1Files:
.github/workflows/build.yml,.github/workflows/docs-preview.yml,.github/workflows/lint.yml.Scope — what's not pinned and why
actions/*(checkout,setup-node,cache,upload-artifact,create-github-app-token): GitHub-owned, trust root, out of scope for this pass.getsentry/*(craft@v2, local reusable workflows, local./action): same-org, separate trust boundary, out of scope.getsentry/action-enforce-license-compliance: already SHA-pinned to4fae092d42cc91cdfa447eb5b0987cbecfdb07c6— no change needed.Verification
python3 -c "import yaml; ..."parses all 7 workflow files cleanly.greppost-change shows only SHA-pinned references for both third-party actions.git ls-remote <repo> 'v4^{}' 'v1^{}'(authoritative deref of annotated tag objects to the commits). Both match the current tip of the respectivev<N>floating tags.Tag-pointer drift from here on is visible in the diff when anyone bumps these references in a future PR.