Skip to content

Commit 559f92b

Browse files
authored
Harden workflow security (#20054)
This PR improves the workflows a bit more by: 1. Making sure that we always use `pnpm install` with a frozen lockfile 2. Cleanup permissions 3. By not caching `~/.cargo/bin/` ## Test plan 1. Every test should still pass [ci-all]
1 parent 6ee1397 commit 559f92b

4 files changed

Lines changed: 8 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
uses: actions/cache@v5
6262
with:
6363
path: |
64-
~/.cargo/bin/
6564
~/.cargo/registry/index/
6665
~/.cargo/registry/cache/
6766
~/.cargo/git/db/
@@ -88,7 +87,7 @@ jobs:
8887
run: rustup target add wasm32-wasip1-threads
8988

9089
- name: Install dependencies
91-
run: pnpm install
90+
run: pnpm install --frozen-lockfile
9291

9392
- name: Build
9493
run: pnpm run build

.github/workflows/integration-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ jobs:
7373
uses: actions/cache@v5
7474
with:
7575
path: |
76-
~/.cargo/bin/
7776
~/.cargo/registry/index/
7877
~/.cargo/registry/cache/
7978
~/.cargo/git/db/

.github/workflows/prepare-release.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ jobs:
104104
uses: actions/cache@v5
105105
with:
106106
path: |
107-
~/.cargo/bin/
108107
~/.cargo/registry/index/
109108
~/.cargo/registry/cache/
110109
~/.cargo/git/db/
@@ -146,7 +145,7 @@ jobs:
146145
run: rustup target add ${{ matrix.target }}
147146

148147
- name: Install dependencies
149-
run: pnpm install --ignore-scripts --filter=!./playgrounds/*
148+
run: pnpm install --ignore-scripts --frozen-lockfile --filter=!./playgrounds/*
150149

151150
- name: Build release
152151
run: pnpm run --filter ${{ env.OXIDE_LOCATION }} build:platform --target=${{ matrix.target }} ${{ matrix.build-flags }}
@@ -204,7 +203,7 @@ jobs:
204203
chmod +x rustup-init
205204
./rustup-init -y --profile minimal
206205
source "$HOME/.cargo/env"
207-
pnpm install --ignore-scripts --filter=!./playgrounds/* || true
206+
pnpm install --ignore-scripts --frozen-lockfile --filter=!./playgrounds/* || true
208207
echo "~~~~ rustc --version ~~~~"
209208
rustc --version
210209
echo "~~~~ node -v ~~~~"
@@ -227,8 +226,6 @@ jobs:
227226

228227
permissions:
229228
contents: write # for softprops/action-gh-release to create GitHub release
230-
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
231-
id-token: write
232229

233230
needs:
234231
- build
@@ -262,7 +259,6 @@ jobs:
262259
uses: actions/cache@v5
263260
with:
264261
path: |
265-
~/.cargo/bin/
266262
~/.cargo/registry/index/
267263
~/.cargo/registry/cache/
268264
~/.cargo/git/db/
@@ -289,7 +285,7 @@ jobs:
289285
run: rustup target add wasm32-wasip1-threads
290286

291287
- name: Install dependencies
292-
run: pnpm --filter=!./playgrounds/* install
288+
run: pnpm --filter=!./playgrounds/* install --frozen-lockfile
293289

294290
- name: Download artifacts
295291
uses: actions/download-artifact@v7

.github/workflows/release.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ jobs:
108108
uses: actions/cache@v5
109109
with:
110110
path: |
111-
~/.cargo/bin/
112111
~/.cargo/registry/index/
113112
~/.cargo/registry/cache/
114113
~/.cargo/git/db/
@@ -150,7 +149,7 @@ jobs:
150149
run: rustup target add ${{ matrix.target }}
151150

152151
- name: Install dependencies
153-
run: pnpm install --ignore-scripts --filter=!./playgrounds/*
152+
run: pnpm install --ignore-scripts --frozen-lockfile --filter=!./playgrounds/*
154153

155154
- name: Build release
156155
run: pnpm run --filter ${{ env.OXIDE_LOCATION }} build:platform --target=${{ matrix.target }} ${{ matrix.build-flags }}
@@ -214,7 +213,7 @@ jobs:
214213
node -v
215214
echo "~~~~ pnpm --version ~~~~"
216215
pnpm --version
217-
pnpm install --ignore-scripts --filter=!./playgrounds/* || true
216+
pnpm install --ignore-scripts --frozen-lockfile --filter=!./playgrounds/* || true
218217
pnpm run --filter ${{ env.OXIDE_LOCATION }} build:platform
219218
strip -x ${{ env.OXIDE_LOCATION }}/*.node
220219
ls -la ${{ env.OXIDE_LOCATION }}
@@ -230,7 +229,7 @@ jobs:
230229
name: Build and publish Tailwind CSS
231230

232231
permissions:
233-
contents: write # for softprops/action-gh-release to create GitHub release
232+
contents: read
234233
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
235234
id-token: write
236235

@@ -280,7 +279,6 @@ jobs:
280279
uses: actions/cache@v5
281280
with:
282281
path: |
283-
~/.cargo/bin/
284282
~/.cargo/registry/index/
285283
~/.cargo/registry/cache/
286284
~/.cargo/git/db/
@@ -307,7 +305,7 @@ jobs:
307305
run: rustup target add wasm32-wasip1-threads
308306

309307
- name: Install dependencies
310-
run: pnpm --filter=!./playgrounds/* install
308+
run: pnpm --filter=!./playgrounds/* install --frozen-lockfile
311309

312310
- name: Download artifacts
313311
uses: actions/download-artifact@v7

0 commit comments

Comments
 (0)