Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

ci: pin every action to a full commit

spacesdrivea638df4c6759
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 76d83b8..ebadfb3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,9 +12,9 @@ jobs:
runs-on: ubuntu-latest
name: Type check, lint, test, build
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- - uses: actions/setup-node@v4
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: 'npm'
diff --git a/.github/workflows/deploy-backend.yml b/.github/workflows/deploy-backend.yml
index 4b1f00a..83d94cb 100644
--- a/.github/workflows/deploy-backend.yml
+++ b/.github/workflows/deploy-backend.yml
@@ -17,9 +17,9 @@ jobs:
runs-on: ubuntu-latest
name: Deploy Cloudflare Worker
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- - uses: actions/setup-node@v4
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: 'npm'
@@ -44,7 +44,7 @@ jobs:
run: npm test --workspace backend
- name: Deploy Worker
- uses: cloudflare/wrangler-action@v4
+ uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
diff --git a/.github/workflows/deploy-frontend.yml b/.github/workflows/deploy-frontend.yml
index 8275274..9f08c39 100644
--- a/.github/workflows/deploy-frontend.yml
+++ b/.github/workflows/deploy-frontend.yml
@@ -17,9 +17,9 @@ jobs:
runs-on: ubuntu-latest
name: Deploy Cloudflare Pages
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- - uses: actions/setup-node@v4
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: 'npm'
@@ -53,7 +53,7 @@ jobs:
VITE_GOOGLE_CLIENT_ID: ${{ secrets.VITE_GOOGLE_CLIENT_ID }}
- name: Deploy to Cloudflare Pages
- uses: cloudflare/wrangler-action@v4
+ uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml
index c1a8b18..bbc64f0 100644
--- a/.github/workflows/deploy-site.yml
+++ b/.github/workflows/deploy-site.yml
@@ -16,9 +16,9 @@ jobs:
runs-on: ubuntu-latest
name: Deploy Cloudflare Pages
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- - uses: actions/setup-node@v4
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: 'npm'
@@ -46,7 +46,7 @@ jobs:
run: npm run build --workspace site
- name: Deploy to Cloudflare Pages
- uses: cloudflare/wrangler-action@v4
+ uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
diff --git a/.github/workflows/publish-scheduled.yml b/.github/workflows/publish-scheduled.yml
index ba4571d..150fa9b 100644
--- a/.github/workflows/publish-scheduled.yml
+++ b/.github/workflows/publish-scheduled.yml
@@ -32,10 +32,10 @@ jobs:
timeout-minutes: 14
steps:
- name: Checkout repository
- uses: actions/checkout@v4
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Setup Node.js
- uses: actions/setup-node@v4
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 035546a..4123342 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
+### Security
+
+- Every GitHub Actions step is pinned to a full commit instead of a movable tag, so a compromised action release cannot reach the deploy secrets (#148)
+
### Documentation
- A security review workflow: every change states its security effect, substantial changes get targeted checks with the Cloudflare and Trail of Bits skills and Semgrep while they are built, and pull requests carry a Security section (`docs/workflows/SECURITY_REVIEW.md`, #148)
diff --git a/docs/architecture/cloudflare/CI_CD.md b/docs/architecture/cloudflare/CI_CD.md
index 9c6193c..45f8be6 100644
--- a/docs/architecture/cloudflare/CI_CD.md
+++ b/docs/architecture/cloudflare/CI_CD.md
@@ -174,11 +174,22 @@ Trigger `publish-scheduled.yml` manually via GitHub Actions UI -> Actions -> "In
Native binaries such as workerd, esbuild, rollup, lightningcss and Tailwind's oxide are optional dependencies, one package per platform. npm skips an optional package it fails to download and still reports a successful install, so a run could reach the Worker bundle without `@cloudflare/workerd-linux-64` (this happened once, on PR #81). `scripts/check-platform-packages.ts` reads the root `package-lock.json`, keeps the optional packages whose `os`, `cpu` and libc match the machine (the glibc and musl builds are told apart by name when the lockfile has no `libc` field), and exits 1 naming any that are missing. Every workflow runs it after `npm ci` and, if it fails, runs `npm ci` and the check once more; a second failure stops the job. Run it locally with `node scripts/check-platform-packages.ts`.
+## Pinned Actions
+
+Every third-party action is pinned to a full commit SHA, with the tag it came from in a comment (`actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4`). Whoever controls an action's repository can move a tag to different code; a commit cannot change, so a compromised action release cannot reach the deploy secrets without a change to this repository. The `@v4` mentions above name the version each pin came from.
+
+To update a pin, resolve the new tag to its commit and replace the SHA and the comment together:
+
+```bash
+gh api repos/actions/checkout/commits/v4 --jq .sha
+```
+
## Adding a New Workflow
1. Create `.github/workflows/my-workflow.yml`
2. Add appropriate path filters to avoid unnecessary runs
-3. If the workflow needs project dependencies, run `actions/setup-node` with Node 24, `cache-dependency-path: package-lock.json` and the install step the other workflows use (`npm ci` at the repository root, then `node scripts/check-platform-packages.ts`, installing again once if it fails); there are no lockfiles inside `backend/`, `frontend/` or `site/`
-4. If it ships code, run `npm run typecheck` (or the workspace's `typecheck` script) before the deploy step
-5. Document it in `docs/architecture/cloudflare/CI_CD.md` (this file)
-6. Add any required secrets via GitHub repo -> Settings -> Secrets -> Actions
+3. Pin every action to a full commit SHA with its tag in a comment (see Pinned Actions)
+4. If the workflow needs project dependencies, run `actions/setup-node` with Node 24, `cache-dependency-path: package-lock.json` and the install step the other workflows use (`npm ci` at the repository root, then `node scripts/check-platform-packages.ts`, installing again once if it fails); there are no lockfiles inside `backend/`, `frontend/` or `site/`
+5. If it ships code, run `npm run typecheck` (or the workspace's `typecheck` script) before the deploy step
+6. Document it in `docs/architecture/cloudflare/CI_CD.md` (this file)
+7. Add any required secrets via GitHub repo -> Settings -> Secrets -> Actions