Skip to content

Commit b8265bb

Browse files
committed
[build] Add --ignore-scripts flag to npm install commands
The --ignore-scripts flag prevents npm from running lifecycle scripts (preinstall, install, postinstall) during dependency installation. This eliminates npm-allow-scripts warnings and improves build security by skipping potentially untrusted package install scripts. Modified commands: - vscode:prepublish: Added --ignore-scripts to npm install - test:prepare: Added --ignore-scripts to npm install Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com> Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 316a808 commit b8265bb

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/circular-dependency-check.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ jobs:
2626

2727
# Run install dependencies
2828
- name: Install dependencies
29-
run: npm ci
29+
run: |
30+
npm ci --ignore-scripts
31+
npm rebuild cpu-features ssh2
3032
3133
- name: Check cycles
3234
run : npm run check-cycles

.github/workflows/continuous-integration-workflow.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656

5757
# Run install dependencies
5858
- name: Install dependencies
59-
run: npm ci
59+
run: |
60+
npm ci --ignore-scripts
61+
npm rebuild cpu-features ssh2
6062
6163
# Run tests without xvfb, if not running on ubuntu
6264
- name: Build and Test (non-Linux)

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ jobs:
4545
- name: Install dependencies
4646
run: |
4747
npm install -g typescript "vsce" "ovsx"
48-
npm install
48+
npm install --ignore-scripts
49+
npm rebuild cpu-features ssh2
4950
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
5051
- name: Build And Run Unit Tests
5152
run: xvfb-run npm run test

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"scripts": {
5050
"compile": "npm run prebuild-esm && node ./build/esbuild.build.cjs",
5151
"build": "npm run prebuild-esm && node ./build/esbuild.build.cjs && npm run bundle-tools",
52-
"vscode:prepublish": "npm install && npm run clean && npm run lint && npm run prebuild-esm && node ./build/esbuild.build.cjs --production && npm run bundle-tools && npm prune --omit=dev",
52+
"vscode:prepublish": "npm install --ignore-scripts && npm run clean && npm run lint && npm run prebuild-esm && node ./build/esbuild.build.cjs --production && npm run bundle-tools && npm prune --omit=dev",
5353
"prebuild-esm": "node ./build/esbuild.transform-esm.cjs",
5454
"watch:extension": "tsc -p tsconfig.json --watch",
5555
"watch:webviews": "node ./build/esbuild.webviews.cjs --watch",
@@ -61,7 +61,7 @@
6161
"check-cycles": "dpdm --no-tree --no-warning --exit-code circular:1 ./src/extension.ts",
6262
"todo": "leasot **/*.ts --ignore node_modules -x",
6363
"clean": "shx rm -rf out/build out/src out/webview out/test out/tools out/test-resources out/**.tsbuildinfo",
64-
"test:prepare": "npm install && npm run test:build-extension && npm run test:build-webviews && shx cp -r test/fixtures out/test/ && npm run bundle-tools",
64+
"test:prepare": "npm install --ignore-scripts && npm run test:build-extension && npm run test:build-webviews && shx cp -r test/fixtures out/test/ && npm run bundle-tools",
6565
"test:build-extension": "npm run prebuild-esm && tsc -p tsconfig.json",
6666
"test:build-webviews": "node ./build/esbuild.webviews.cjs",
6767
"test:instrument": "shx rm -rf out/src-orig && shx mv out/src out/src-orig && istanbul instrument --complete-copy --embed-source --output out/src out/src-orig",

0 commit comments

Comments
 (0)