From 193de5182f2f926a4d85ae31761e794c7c80d8c4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 17 Apr 2024 15:12:29 +0100 Subject: [PATCH] Update scripts for compatibility with latest NodeJS Security Release (#1628) Co-authored-by: David Baker --- hak/keytar/build.ts | 3 +++ scripts/hak/fetch.ts | 3 +++ scripts/hak/link.ts | 6 ++++++ scripts/set-version.ts | 5 +++++ 4 files changed, 17 insertions(+) diff --git a/hak/keytar/build.ts b/hak/keytar/build.ts index ec7c8b5..31df28b 100644 --- a/hak/keytar/build.ts +++ b/hak/keytar/build.ts @@ -32,6 +32,9 @@ export default async function buildKeytar(hakEnv: HakEnv, moduleInfo: Dependency cwd: moduleInfo.moduleBuildDir, env, stdio: "inherit", + // We need shell mode on Windows to be able to launch `.cmd` executables + // See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2 + shell: hakEnv.isWin(), }, ); proc.on("exit", (code) => { diff --git a/scripts/hak/fetch.ts b/scripts/hak/fetch.ts index d1bf61d..fa3a80c 100644 --- a/scripts/hak/fetch.ts +++ b/scripts/hak/fetch.ts @@ -44,6 +44,9 @@ export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo): const proc = childProcess.spawn(hakEnv.isWin() ? "yarn.cmd" : "yarn", ["install", "--ignore-scripts"], { stdio: "inherit", cwd: moduleInfo.moduleBuildDir, + // We need shell mode on Windows to be able to launch `.cmd` executables + // See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2 + shell: hakEnv.isWin(), }); proc.on("exit", (code) => { code ? reject(code) : resolve(); diff --git a/scripts/hak/link.ts b/scripts/hak/link.ts index 05fd4e6..c2613a9 100644 --- a/scripts/hak/link.ts +++ b/scripts/hak/link.ts @@ -53,6 +53,9 @@ export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo): const proc = childProcess.spawn(yarnCmd, ["link"], { cwd: moduleInfo.moduleOutDir, stdio: "inherit", + // We need shell mode on Windows to be able to launch `.cmd` executables + // See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2 + shell: hakEnv.isWin(), }); proc.on("exit", (code) => { code ? reject(code) : resolve(); @@ -63,6 +66,9 @@ export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo): const proc = childProcess.spawn(yarnCmd, ["link", moduleInfo.name], { cwd: hakEnv.projectRoot, stdio: "inherit", + // We need shell mode on Windows to be able to launch `.cmd` executables + // See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2 + shell: hakEnv.isWin(), }); proc.on("exit", (code) => { code ? reject(code) : resolve(); diff --git a/scripts/set-version.ts b/scripts/set-version.ts index 3108395..3189a57 100755 --- a/scripts/set-version.ts +++ b/scripts/set-version.ts @@ -32,6 +32,11 @@ export async function setPackageVersion(ver: string): Promise { "--new-version", ver, ], + { + // We need shell mode on Windows to be able to launch `.cmd` executables + // See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2 + shell: process.platform === "win32", + }, (err) => { if (err) { reject(err);