From a24b4e5b0556af6106784ba9a3c5b3bbd1f6b577 Mon Sep 17 00:00:00 2001 From: Ivan Pereira <183991+ivanrvpereira@users.noreply.github.com> Date: Tue, 14 Jul 2026 12:42:55 +0100 Subject: [PATCH] ci: harden workflows against token exfiltration Disable checkout credential persistence so repository-controlled code run by npm ci/test cannot read GITHUB_TOKEN from .git/config, and pin actions to full commit SHAs to guard against mutable-tag supply-chain attacks. --- .github/workflows/ci.yml | 6 ++++-- .github/workflows/npm-publish.yml | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d8a418..3411d9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + with: + persist-credentials: false - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 24 diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index b6e990b..549c4ad 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -14,9 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: fetch-depth: 0 + persist-credentials: false - name: Verify tag is on main run: | @@ -26,7 +27,7 @@ jobs: } - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 24 registry-url: 'https://registry.npmjs.org'