-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension asset upload #361
base: master
Are you sure you want to change the base?
Conversation
const isNodeVersionIsGreaterThan18 = | ||
+process.version.split('.')[0].slice(1) >= 18; | ||
let b = exec( | ||
`node ${VUE_CLI_PATH} build --target lib src/index.js --name ${bundleName}`, | ||
`node ${VUE_CLI_PATH} build --target lib src/index.js --name ${bundleName} --filename ${assetHash}_${bundleName}`, |
Check failure
Code scanning / CodeQL
Uncontrolled command line Critical
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we should avoid using exec
with a single concatenated string that includes user input. Instead, we can use execFile
or execFileSync
, which allows us to pass command arguments as an array of strings. This approach is safer and mitigates the risk of command injection.
- Replace the
exec
function withexecFile
. - Pass the command and its arguments as separate elements in an array.
- Ensure that the
bundleName
and other variables are passed as separate arguments to avoid shell interpretation.
-
Copy modified line R27 -
Copy modified lines R550-R559
@@ -26,3 +26,3 @@ | ||
import inquirer from 'inquirer'; | ||
import { exec } from 'child_process'; | ||
import { execFile } from 'child_process'; | ||
import * as cheerio from 'cheerio'; | ||
@@ -549,4 +549,12 @@ | ||
+process.version.split('.')[0].slice(1) >= 18; | ||
let b = exec( | ||
`node ${VUE_CLI_PATH} build --target lib src/index.js --name ${bundleName} --filename ${assetHash}_${bundleName}`, | ||
let b = execFile( | ||
'node', | ||
[ | ||
VUE_CLI_PATH, | ||
'build', | ||
'--target', 'lib', | ||
'src/index.js', | ||
'--name', bundleName, | ||
'--filename', `${assetHash}_${bundleName}` | ||
], | ||
{ |
No description provided.