fix: recognize allowScripts for local link targets#9497
Merged
Conversation
## Summary - Recognize local directory link targets by their incoming link source when matching `allowScripts` policy entries. - Reuse that source identity when `approve-scripts`/`deny-scripts` derive file dependency policy keys. - Add coverage for reviewed local `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.js` - `node 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.js` - `git diff --check` - Manual repro: local `file:` dependency with `allowScripts: { "file:../testdep": false }` no longer emits an `allow-scripts` warning; `npm approve-scripts --all` writes `file:../testdep`. --------- Co-authored-by: cyphercodes <cyphercodes@users.noreply.github.com> (cherry picked from commit 2cbb13b)
owlstronaut
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #9490 to
release/v11.