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 | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
| 337 | + | |
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| |||
| 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 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
0 commit comments