fix: use cross-spawn to resolve DEP0190 in dataconnect init#10558
fix: use cross-spawn to resolve DEP0190 in dataconnect init#10558fredzqm wants to merge 3 commits into
Conversation
Co-authored-by: fredzqm <9068391+fredzqm@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request replaces the native child_process spawn with cross-spawn and removes the shell: true option when executing commands. The reviewer points out that removing shell: true prevents manual shell-quoting of arguments from being stripped, which will cause issues in createNextApp where nested double quotes are used for the import alias. The reviewer suggests updating createNextApp to remove the nested double quotes.
| const childProcess = spawn(command, args, { | ||
| // 'inherit' pipes stdin, stdout, and stderr to the parent process | ||
| stdio: "inherit", | ||
| // Runs the command in a shell, which allows for shell syntax like pipes, etc. | ||
| shell: true, | ||
| }); |
There was a problem hiding this comment.
With the removal of shell: true, arguments are no longer evaluated by a shell. This means any manual shell-quoting of arguments in the calling functions is no longer stripped and will be passed literally to the spawned process.
Specifically, in createNextApp (around line 23), the import alias argument is defined as '"@/*"'. Because shell: true is removed, the literal double quotes will be passed to create-next-app, resulting in an invalid import alias configuration in the generated Next.js app.
Please update createNextApp to remove the nested double quotes:
"--import-alias",
"@/*",Co-authored-by: fredzqm <9068391+fredzqm@users.noreply.github.com>
Co-authored-by: fredzqm <9068391+fredzqm@users.noreply.github.com>
Fixes a Node.js
DEP0190DeprecationWarning that occurs when runningfirebase init dataconnectwhile creating an app template.The warning (
Passing args to a child process with shell option true can lead to security vulnerabilities) was triggered becausechild_process.spawnwas used with theshell: trueoption to ensure commands likenpmandnpxran correctly on all platforms.This fix updates
src/init/features/dataconnect/create_app.tsto usecross-spawninstead, which properly escapes arguments and handles cross-platform execution (especially on Windows) without needing the unsafeshell: trueoption.PR created automatically by Jules for task 8312636168148387415 started by @fredzqm