fix: recognize allowScripts for local link targets#9490
Conversation
|
@JamieMagee So this looks valid to me for v11, if the user has added One thing I'd like your read on for v12 before this lands there: in rebuild.js the |
owlstronaut
left a comment
There was a problem hiding this comment.
This adds node.realpath and node.path to the spec list for every node. A registry-resolved package can't match a file policy key because matchFileOrDir short circuits. With this change a registry package like sharp@0.33.0 installed at proj/node_modules/sharp will match a k ey like file:/proj/node_modules/sharp": true.
Summary
allowScriptspolicy entries.approve-scripts/deny-scriptsderive file dependency policy keys.file:dependency link targets.Fixes #9488
Testing
node node_modules/tap/bin/run.js --no-coverage workspaces/arborist/test/script-allowed.js workspaces/arborist/test/unreviewed-scripts.js test/lib/utils/allow-scripts-writer.js test/lib/utils/check-allow-scripts.js test/lib/utils/resolve-allow-scripts.jsnode node_modules/eslint/bin/eslint.js lib/utils/allow-scripts-writer.js test/lib/utils/allow-scripts-writer.js workspaces/arborist/lib/script-allowed.js workspaces/arborist/test/script-allowed.js workspaces/arborist/test/unreviewed-scripts.jsgit diff --checkfile:dependency withallowScripts: { "file:../testdep": false }no longer emits anallow-scriptswarning;npm approve-scripts --allwritesfile:../testdep.