-
-
Notifications
You must be signed in to change notification settings - Fork 224
chore: Pin GitHub Actions to commit SHA #4562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: Pin GitHub Actions to commit SHA #4562
Conversation
@sentry review |
github needs to run actions/checkout before it can see local actions.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4562 +/- ##
==========================================
+ Coverage 73.34% 73.47% +0.12%
==========================================
Files 479 482 +3
Lines 17509 17679 +170
Branches 3445 3495 +50
==========================================
+ Hits 12842 12989 +147
- Misses 3788 3799 +11
- Partials 879 891 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@sentry review |
bugbot review |
👍 for pinning all those 3rd party Docker actions etc. but I'd vote for leaving the official |
Co-authored-by: Stefan Pölz <[email protected]>
Co-authored-by: Stefan Pölz <[email protected]>
Some remaining tags in
|
And one more comment missing ... for consistency:
-uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8
+uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 # v1.3.0 |
I'm definitely not a fan of this change. If everyone else really wants to do this, then I'll go with the flow, but I far prefer the readable tags/labels to the commit hashes... and the problem we're trying to solve here seems like a highly unlikely hypothetical problem. Do we know anyone who has been scorched by this? |
https://snyk.io/blog/reconstructing-tj-actions-changed-files-github-actions-compromise/ @jamescrosswell This seems to be an example of what a possible attack could look like. |
I see... depressing. That will make it much harder to review PRs. If I see a commit hash, the only way I have of verifying whether it's doing what we intend it to do is by going back to the repo where the action comes from, checking whether the appropriate label has been applied to that commit hash and also checking to make sure the commit hash doesn't correspond to an orphaned branch. Probably not the kind of thing humans should be spending their time doing (and we wouldn't do it very reliably even if we tried). |
I agree it's way more cumbersome to have commit hashes instead of version tags. Dependabot automates the actual updates, but that doesn't change the fact that we (should) review those PRs. I think it is worth the extra security in my opinion though. Other repos in Sentry also pin official GitHub Actions - such as Note: something I found during my research - Open Source Security Foundation (OSSF) recommends people to pin GH Actions to commit SHAs too. See second last point in https://github.com/ossf/scorecard/blob/main/docs/checks.md#pinned-dependencies I'm not saying OSSF is a omnipresent source for GitHub Action security, but with 5k stars, seems pretty reputable. Just for fun, you can see |
Closes #4540
Problem
According to GitHub Actions security best practices, we should pin actions to a full-length commit SHA.
#skip-changelog
Note
Pins all CI actions and reusable workflows to specific commit SHAs across GitHub workflows and the buildnative composite action.
actions/checkout@v5
,actions/cache@v4
(andcache/restore
),actions/upload-artifact@v4
,actions/download-artifact@v5
,codecov/codecov-action
,microsoft/setup-msbuild
.docker/login-action
,docker/setup-qemu-action
,docker/setup-buildx-action
,docker/build-push-action
.github/codeql-action/{init,analyze}
,gradle/actions/setup-gradle
,reactivecircus/android-emulator-runner
,styfle/cancel-workflow-action
.getsentry/github-workflows
(danger, updater),getsentry/action-prepare-release
,getsentry/github-workflows/sentry-cli/integration-test
..github/actions/buildnative
):actions/cache@v3
with pinnedactions/cache@v4
SHAs for C and Android supplemental builds.Written by Cursor Bugbot for commit 4783fed. This will update automatically on new commits. Configure here.