-
-
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
Feat/update rn 0.76.5 #1838
base: main
Are you sure you want to change the base?
Feat/update rn 0.76.5 #1838
Conversation
`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 5 days ago
To fix the problem, we should avoid constructing the shell command as a single string and instead use child_process.spawn
or child_process.execFile
to pass the command and its arguments as an array. This approach ensures that each argument is treated as a separate entity, preventing shell interpretation of special characters.
- Replace the string concatenation with an array of arguments.
- Use
child_process.spawn
to execute the command with the arguments array.
-
Copy modified lines R59-R64 -
Copy modified lines R66-R67
@@ -58,6 +58,11 @@ | ||
} | ||
const command = 'node'; | ||
const commandArgs = [ | ||
`${doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native')}/cli.js`, | ||
...args, | ||
`--config=${c.runtime.runtimeExtraProps?.reactNativeMetroConfigName || 'metro.config.js'}`, | ||
]; | ||
return executeAsync( | ||
`node ${doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native')}/cli.js ${args.join( | ||
' ' | ||
)} --config=${c.runtime.runtimeExtraProps?.reactNativeMetroConfigName || 'metro.config.js'}`, | ||
command, | ||
commandArgs, | ||
{ |
Description
Platforms that works:
Related issues
Npm releases
n/a