Skip to content

Commit 3d6956b

Browse files
Improve npm package installation security (#57)
* Improve npm package installations security * Add @types/node as a dev dep
1 parent f63b5f9 commit 3d6956b

5 files changed

Lines changed: 70 additions & 918 deletions

File tree

.github/workflows/build-docs.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v7
16+
- uses: actions/setup-node@v6
17+
with:
18+
node-version: '24.x'
19+
registry-url: 'https://registry.npmjs.org'
20+
cache: npm
1621
- name: Setup Pages
1722
uses: actions/configure-pages@v5
23+
- run: npm install -g npm@11 --registry=https://registry.npmjs.org
1824
- run: npm ci
1925
- name: Build docs
2026
run: npm run docs

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ jobs:
1111
permissions:
1212
contents: read
1313
steps:
14-
- uses: actions/checkout@v4
15-
- uses: actions/setup-node@v4
14+
- uses: actions/checkout@v7
15+
- uses: actions/setup-node@v6
1616
with:
17-
node-version: '20.x'
17+
node-version: '24.x'
1818
registry-url: 'https://registry.npmjs.org'
1919
cache: npm
20+
- run: npm install -g npm@11 --registry=https://registry.npmjs.org
2021
- run: npm ci
2122
- run: npm run ci
22-
- run: npm publish
23+
- run: npm publish --allow-directory=all
2324
if: github.event_name == 'release' && github.event.action == 'created'
2425
env:
2526
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
access=public
22
save-exact=true
3+
4+
min-release-age=7
5+
min-release-age-exclude[]=@microbit/*
6+
min-release-age-exclude[]=@microbit-foundation/*
7+
8+
# root here means this project's package.json
9+
allow-git=root
10+
allow-remote=root
11+
allow-file=root
12+
allow-directory=root
13+
14+
strict-allow-scripts=true
15+
16+
engine-strict=true

0 commit comments

Comments
 (0)