Skip to content

Commit 16e96db

Browse files
authored
Use ignore-scripts to guard against supply-chain attacks (#4045)
1 parent b1b47e9 commit 16e96db

File tree

6 files changed

+24
-295
lines changed

6 files changed

+24
-295
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# Except the following.
55
!.env
6+
!.npmrc
67
!.parcelrc
78
!dev-requirements.txt
89
!docs/user_guide

.github/workflows/frontend.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ permissions: # added using https://github.com/step-security/secure-workflows
1919
jobs:
2020
lint_build:
2121
runs-on: ubuntu-latest
22+
env:
23+
npm_config_ignore_scripts: true
2224
strategy:
2325
matrix:
2426
node-version: [22]
@@ -41,13 +43,19 @@ jobs:
4143
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
4244
with:
4345
node-version: ${{ matrix.node-version }}
44-
- run: npm ci
45-
- run: npm run fmt-frontend-check
46-
- run: npm run lint
47-
- run: npm run build
46+
- name: Install dependencies
47+
run: npm ci --ignore-scripts
48+
- name: Format-check frontend
49+
run: npm run fmt-frontend-check
50+
- name: Lint frontend
51+
run: npm run lint
52+
- name: Build frontend
53+
run: npm run build
4854

4955
test_coverage:
5056
runs-on: ubuntu-latest
57+
env:
58+
npm_config_ignore_scripts: true
5159
strategy:
5260
matrix:
5361
node-version: [22]
@@ -70,7 +78,8 @@ jobs:
7078
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
7179
with:
7280
node-version: ${{ matrix.node-version }}
73-
- run: npm ci
81+
- name: Install dependencies
82+
run: npm ci --ignore-scripts
7483
- name: Run tests and generate coverage
7584
run: npm run test-frontend:coverage
7685
env:

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore-scripts=true

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ FROM node:22.21.1-bookworm-slim@sha256:4de72fb3998934a953f1bee37f0e0254b27c53520
2828
WORKDIR /app
2929

3030
# Install app dependencies.
31+
COPY .npmrc ./
3132
COPY package*.json ./
32-
RUN npm ci
33+
RUN npm ci --ignore-scripts
3334

3435
# Build application.
3536
COPY . ./

0 commit comments

Comments
 (0)