-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: correct directory in wasm update #108
Conversation
b9fd333
to
0acc9ee
Compare
it seems this is not the right solution |
0acc9ee
to
d6ce352
Compare
tools/build-wasm.js
Outdated
|
||
try { | ||
for (const command of commands) { | ||
execSync(command, { stdio: "inherit" }); |
Check warning
Code scanning / CodeQL
Shell command built from environment values
This autofix suggestion was applied.
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 months ago
To fix the problem, we should avoid dynamically constructing shell commands with environment values that can be interpreted by the shell. Instead, we should use the execFileSync
method to pass the command and its arguments separately, which prevents the shell from interpreting special characters.
Specifically, we need to:
- Split the commands in the
commands
array into the command and its arguments. - Use
execFileSync
to execute the commands with the arguments passed as an array.
-
Copy modified lines R68-R72 -
Copy modified lines R76-R77
@@ -67,7 +67,7 @@ | ||
const commands = [ | ||
`cd ${wasmBindingPath}`, | ||
"cargo install --locked wasm-pack", | ||
"export PATH=/home/node/.cargo/bin:$PATH", | ||
`sh ${wasmBindingPath}/scripts/build.sh`, | ||
`cp -r ${wasmBindingPath}/pkg/* ${ROOT}/lib`, | ||
["sh", "-c", `cd ${wasmBindingPath}`], | ||
["cargo", "install", "--locked", "wasm-pack"], | ||
["sh", "-c", "export PATH=/home/node/.cargo/bin:$PATH"], | ||
["sh", `${wasmBindingPath}/scripts/build.sh`], | ||
["cp", "-r", `${wasmBindingPath}/pkg/*`, `${ROOT}/lib`], | ||
]; | ||
@@ -75,4 +75,4 @@ | ||
try { | ||
for (const command of commands) { | ||
execSync(command, { stdio: "inherit" }); | ||
for (const [cmd, ...args] of commands) { | ||
execFileSync(cmd, args, { stdio: "inherit" }); | ||
} |
d6ce352
to
d6d5576
Compare
…alues Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mhdawson I gave it a try but I cannot figure out how to fix this |
Fixes: /~https://github.com/nodejs/amaro/actions/runs/11655811754/job/32451022570
@mhdawson