{{ message }}
Repository navigation
Commit b016aa2
authored
fix(config): avoid exporting persistent allow-scripts (#9913)
## What / Why
A user or global `.npmrc` can define `allow-scripts` as persistent
policy. `setEnvs()` currently carries that non-default value into
lifecycle child processes as `npm_config_allow_scripts`. If a lifecycle
script runs a nested project-scoped `npm install`, the inner process
treats the inherited value as an environment override and rejects it
with `EALLOWSCRIPTS` instead of reloading the policy from its persistent
config source.
Mark `allow-scripts` as non-exportable. This only prevents `setEnvs()`
from synthesizing the lifecycle environment variable; it does not remove
an explicitly supplied environment value or change how the outer command
reads its config. Pacote's git-preparation environment filtering and
#9783 are outside this change.
The regression test models a user-level value in the inherited config
chain and verifies that lifecycle scripts do not receive
`npm_config_allow_scripts`.
## AI assistance
OpenAI Codex assisted with analysis, implementation, and test design.
The patch was verified with the focused regression, the complete
`@npmcli/config` suite, lint, and template checks.
## References
Fixes #99121 parent 81a901c commit b016aa2
4 files changed
Lines changed: 54 additions & 1 deletion
File tree
- tap-snapshots/test/lib
- test/lib/utils
- workspaces/config
- lib/definitions
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
89 | 105 | | |
90 | 106 | | |
91 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
| |||

0 commit comments