-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
update_RN_0.76.3 #1820
base: main
Are you sure you want to change the base?
update_RN_0.76.3 #1820
Conversation
It seems like building tvos now requires |
`node ${doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native')}/cli.js ${args.join( | ||
' ' | ||
)} --config=${c.runtime.runtimeExtraProps?.reactNativeMetroConfigName || 'metro.config.js'}`, |
Check warning
Code scanning / CodeQL
Unsafe shell command constructed from library input Medium
library input
shell command
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 18 days ago
To fix the problem, we should avoid constructing the shell command using string concatenation and instead use a safer method to pass arguments to the command. The child_process.execFile
method is a safer alternative as it allows us to pass arguments as an array, avoiding shell interpretation.
- Replace the
executeAsync
call withchild_process.execFile
to execute the command. - Construct the command and its arguments as separate elements in an array.
- Ensure all dynamic inputs are properly escaped or validated.
-
Copy modified lines R59-R66 -
Copy modified lines R74-R81
@@ -58,7 +58,10 @@ | ||
} | ||
return executeAsync( | ||
`node ${doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native')}/cli.js ${args.join( | ||
' ' | ||
)} --config=${c.runtime.runtimeExtraProps?.reactNativeMetroConfigName || 'metro.config.js'}`, | ||
{ | ||
const command = 'node'; | ||
const commandArgs = [ | ||
`${doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native')}/cli.js`, | ||
...args, | ||
`--config=${c.runtime.runtimeExtraProps?.reactNativeMetroConfigName || 'metro.config.js'}` | ||
]; | ||
return new Promise((resolve, reject) => { | ||
child_process.execFile(command, commandArgs, { | ||
env: { | ||
@@ -70,4 +73,10 @@ | ||
}, | ||
} | ||
); | ||
}, (error, stdout, stderr) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(stdout); | ||
} | ||
}); | ||
}); | ||
}; |
Description
Related issues
Npm releases
n/a