Skip to content

Commit 017caa9

Browse files
committed
fix(dlx): prevent post-install scripts from running
Add ignoreScripts: true to Arborist options to prevent install and post-install scripts from running during dlx package installation. This is a security measure to prevent potentially malicious scripts from executing during dependency installation.
1 parent 093d956 commit 017caa9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/dlx-package.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ async function ensurePackageInstalled(
293293
cache: pacoteCachePath || path.join(packageDir, '.cache'),
294294
// Skip devDependencies (production-only like npx).
295295
omit: ['dev'],
296+
// Security: Skip install/preinstall/postinstall scripts to prevent arbitrary code execution.
297+
// Note: binLinks defaults to true, which is needed for dlx to execute the package binary.
298+
ignoreScripts: true,
296299
})
297300

298301
await arb.buildIdealTree()

0 commit comments

Comments
 (0)