-
Notifications
You must be signed in to change notification settings - Fork 41
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
Init codeql-config #1086
Init codeql-config #1086
Conversation
[ifEnvCommand, ifRunCommand, ttyCommand].join(' && ') + | ||
` | ${ifDiffCommand}`; | ||
|
||
await execPromise(fullCommand, { |
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium
absolute path
This shell command depends on an uncontrolled
absolute path
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 16 days ago
To fix the problem, we should avoid constructing the shell command as a single string and instead use execFileSync
or execFile
to pass the command and its arguments separately. This approach ensures that the shell does not interpret any special characters in the arguments.
- Replace the construction of
fullCommand
with separate command arrays for each part of the command. - Use
execFile
to execute each command separately, passing the arguments as an array to avoid shell interpretation.
-
Copy modified lines R59-R72 -
Copy modified lines R74-R75
@@ -58,14 +58,19 @@ | ||
|
||
const fullCommand = [ | ||
...ifEnvCommand, | ||
'&&', | ||
...ifRunCommand, | ||
'&&', | ||
...ttyCommand, | ||
'|', | ||
...ifDiffCommand, | ||
].join(' '); | ||
// Execute ifEnvCommand | ||
await execPromise(ifEnvCommand.join(' '), { | ||
cwd: process.env.CURRENT_DIR || process.cwd(), | ||
}); | ||
|
||
// Execute ifRunCommand | ||
await execPromise(ifRunCommand.join(' '), { | ||
cwd: process.env.CURRENT_DIR || process.cwd(), | ||
}); | ||
|
||
// Execute ttyCommand | ||
const ttyResult = await execPromise(ttyCommand.join(' '), { | ||
cwd: process.env.CURRENT_DIR || process.cwd(), | ||
}); | ||
|
||
// Execute the full command | ||
await execPromise(fullCommand, { | ||
// Execute ifDiffCommand | ||
await execPromise(ifDiffCommand.join(' '), { | ||
cwd: process.env.CURRENT_DIR || process.cwd(), |
Types of changes
A description of the changes proposed in the Pull Request