Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
npm exec
is interpreting argv strings that look like environment variables. Passing, for example, test$param
results in test
being passed to the module (because param
is not defined in the environment).
Expected Behavior
Strings passed should not be interpreted.
Steps To Reproduce
-
Issue occurs with this environment:
npm
>=v7.1.0.
Earlier versions are unaffected.
Installednode
version doesn't appear to matter (tested with various v14/v15/v16 releases) -
With this config
a file innode_modules/.bin/testington
with this content:
#!/usr/bin/env node
console.log(process.argv[2]);
- Run '...'
Note proper quotes used to avoid bash interpreting the string.
$ npm exec testington 'test$param'
test
$ export param=asdf
$ npm exec testington 'test$param'
testasdf
- See error...
Note that npx intereprets environment variables within the string before they reach the module.
Environment
- OS: Ubuntu 20.04
- Node: v16.6.0
- npm: 7.1.0