Skip to content

Commit e05485d

Browse files
authored
πŸ”’ Pin GitHub Actions to commit SHAs (#2069)
## πŸ”’ Pin GitHub Actions to commit SHAs This PR pins all GitHub Actions to their exact commit SHA instead of mutable tags or branch names. **Why?** Pinning to a SHA prevents supply chain attacks where a tag (e.g. `v4`) could be moved to point to malicious code. ### Changes | Workflow | Action | Avant | AprΓ¨s | SHA | |---|---|---|---|---| | `trufflehog.yml` | `actions/checkout` | `v4` | `v6.0.2` | `de0fac2e4500…` | | `trufflehog.yml` | `trufflesecurity/trufflehog` | `main` | `main` | `6bd2d14f7a4b…` | | `ollama-template-update.yml` | `actions/checkout` | `v3` | `v6.0.2` | `de0fac2e4500…` | | `ollama-template-update.yml` | `actions/github-script` | `v6` | `v6` | `d7906e4ad0b1…` | | `documentation.yml` | `huggingface/doc-builder/.github/workflows/build_main_documentation.yml` | `main` | `main` | `90b4ee2c10b8…` | | `pr-documentation.yml` | `huggingface/doc-builder/.github/workflows/build_pr_documentation.yml` | `main` | `main` | `90b4ee2c10b8…` | | `upload-pr-documentation.yml` | `huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml` | `main` | `main` | `90b4ee2c10b8…` | | `update-specs.yml` | `actions/checkout` | `v3` | `v6.0.2` | `de0fac2e4500…` | | `update-specs.yml` | `actions/setup-node` | `v3` | `v3` | `3235b876344d…` | | `update-specs.yml` | `pnpm/action-setup` | `v2` | `v2` | `eae0cfeb286e…` | | `update-specs.yml` | `peter-evans/create-pull-request` | `v7` | `v7` | `22a9089034f4…` | | `agents-publish.yml` | `actions/checkout` | `v5` | `v6.0.2` | `de0fac2e4500…` | | `agents-publish.yml` | `actions/setup-node` | `v4` | `v4` | `49933ea5288c…` | | `agents-publish.yml` | `actions/setup-node` | `v4` | `v4` | `49933ea5288c…` | | `agents-publish.yml` | `peter-evans/repository-dispatch` | `v2` | `v2` | `bf47d102fdb8…` | > πŸ€– Generated by `/github-actions-audit` β€” [security/pin-actions-to-sha] Closes huggingface/tracking-issues#145 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: changes are limited to CI workflow `uses:` references, but a wrong SHA could break releases/docs/spec update automation. > > **Overview** > Pins all referenced GitHub Actions and reusable doc-builder workflows in `.github/workflows/*` to immutable commit SHAs (replacing version tags/`main`) for supply-chain hardening. > > This updates checkout/node/pnpm/action helpers as well as `doc-builder`, TruffleHog scanning, and PR/spec automation workflows without changing the underlying job logic. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 41ede40. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 47b7e5c commit e05485d

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

β€Ž.github/workflows/agents-publish.ymlβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ jobs:
2828
version_and_release:
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v5
31+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3232
with:
3333
# Needed to push the tag and the commit on the main branch, otherwise we get:
3434
# > Run git push --follow-tags
3535
# remote: error: GH006: Protected branch update failed for refs/heads/main.
3636
# remote: error: Changes must be made through a pull request. Required status check "lint" is expected.
3737
token: ${{ secrets.BOT_ACCESS_TOKEN }}
3838
- run: npm install -g corepack@latest && corepack enable
39-
- uses: actions/setup-node@v4
39+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
4040
with:
4141
node-version: "24"
4242
cache: "pnpm"
@@ -61,7 +61,7 @@ jobs:
6161

6262
- run: pnpm --filter agents... build && pnpm publish --no-git-checks .
6363
# hack - reuse actions/setup-node@v4 just to set a new registry
64-
- uses: actions/setup-node@v4
64+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
6565
with:
6666
node-version: "24"
6767
registry-url: "https://npm.pkg.github.com"
@@ -70,7 +70,7 @@ jobs:
7070
env:
7171
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7272
- name: "Update Doc"
73-
uses: peter-evans/repository-dispatch@v2
73+
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2
7474
with:
7575
event-type: doc-build
7676
token: ${{ secrets.BOT_ACCESS_TOKEN }}

β€Ž.github/workflows/documentation.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616

1717
jobs:
1818
build:
19-
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
19+
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@90b4ee2c10b81b5c1a6367c4e6fc9e2fb510a7e3 # main
2020
with:
2121
commit_sha: ${{ github.sha }}
2222
package: huggingface.js

β€Ž.github/workflows/ollama-template-update.ymlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
update-ollama-templates:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1818
if: github.repository == 'huggingface/huggingface.js'
1919

2020
- name: Prepare
@@ -76,7 +76,7 @@ jobs:
7676
7777
- name: Create PR
7878
if: steps.changes.outputs.HAS_CHANGES == 'true' && github.repository == 'huggingface/huggingface.js'
79-
uses: actions/github-script@v6
79+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
8080
env:
8181
CURRENT_DATE: ${{ steps.prepare.outputs.CURRENT_DATE }}
8282
NEW_BRANCH: ${{ steps.changes.outputs.NEW_BRANCH }}

β€Ž.github/workflows/pr-documentation.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616

1717
jobs:
1818
build:
19-
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
19+
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@90b4ee2c10b81b5c1a6367c4e6fc9e2fb510a7e3 # main
2020
with:
2121
commit_sha: ${{ github.sha }}
2222
pr_number: ${{ github.event.number }}

β€Ž.github/workflows/trufflehog.ymlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1515
with:
1616
fetch-depth: 0
1717
- name: Secret Scanning
18-
uses: trufflesecurity/trufflehog@main
18+
uses: trufflesecurity/trufflehog@6bd2d14f7a4bc1e569fa3550efa7ec632a4fa67b # main
1919
with:
2020
extra_args: --results=verified,unknown

β€Ž.github/workflows/update-specs.ymlβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
# Setup
21-
- uses: actions/checkout@v3
22-
- uses: actions/setup-node@v3
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22+
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
2323
with:
2424
node-version: "20"
2525
- name: Install pnpm
26-
uses: pnpm/action-setup@v2
26+
uses: pnpm/action-setup@eae0cfeb286e66ffb5155f1a79b90583a127a68b # v2
2727
with:
2828
run_install: true
2929

@@ -37,7 +37,7 @@ jobs:
3737

3838
# Create or update Pull Request
3939
- name: Create Pull Request
40-
uses: peter-evans/create-pull-request@v7
40+
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7
4141
with:
4242
token: ${{ secrets.TOKEN_INFERENCE_SYNC_BOT }}
4343
commit-message: Update tasks specs (automated commit)

β€Ž.github/workflows/upload-pr-documentation.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@main
11+
uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@90b4ee2c10b81b5c1a6367c4e6fc9e2fb510a7e3 # main
1212
with:
1313
package_name: huggingface.js
1414
secrets:

0 commit comments

Comments
Β (0)