Merge upstream puppeteer 22.15.0 - #174
Conversation
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
…on event (#12777)
…er BiDi (#12771) Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…799) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
… (#12835) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ith 10 updates (#12841) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…e all group (#12837) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
| } | ||
| spawnSync( | ||
| path.join(browserDir, 'setup.exe'), | ||
| [`--configure-browser-in-directory=` + browserDir], |
Check warning
Code scanning / CodeQL
Unsafe shell command constructed from library input Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
In general, the fix is to avoid letting untrusted or library-controlled data be interpreted by a shell. For Node’s child_process, that means using spawn/spawnSync with shell: false (the default) and passing arguments as an array, or using execFile instead of exec. If you truly need shell features like pipes or redirection, input must be carefully quoted/escaped with something like shell-quote.
In this specific case, runSetup only needs to run setup.exe with a single argument --configure-browser-in-directory=<browserDir>. There is no need for shell features, so we can safely call spawnSync directly with shell: false. Since spawnSync is already called with the program path and an array of arguments, the minimal fix is:
- Remove the
{ shell: true }option so the shell is not involved. - Optionally (but not strictly necessary for correctness), we can pass the argument as a full string as we already do:
`--configure-browser-in-directory=` + browserDir.spawnSyncwill handle it as one argument.
This preserves existing functionality (invoking setup.exe with the same argument) while preventing any shell interpretation of browserDir. No additional imports, methods, or dependencies are required. All changes occur in packages/browsers/src/install.ts within the runSetup function.
| @@ -288,13 +288,9 @@ | ||
| if (!existsSync(setupExePath)) { | ||
| return; | ||
| } | ||
| spawnSync( | ||
| path.join(browserDir, 'setup.exe'), | ||
| [`--configure-browser-in-directory=` + browserDir], | ||
| { | ||
| shell: true, | ||
| } | ||
| ); | ||
| spawnSync(path.join(browserDir, 'setup.exe'), [ | ||
| `--configure-browser-in-directory=` + browserDir, | ||
| ]); | ||
| // TODO: Handle error here. Currently the setup.exe sometimes | ||
| // errors although it sets the permissions correctly. | ||
| } finally { |
80d9375 to
57c562e
Compare
- Merge 42 commits from upstream puppeteer-core v22.15.0 - Resolves conflicts keeping Cloudflare Workers compatibility - Removes BiDi files (not supported in Workers fork) - Updates dependencies: - @puppeteer/browsers: 2.2.4 -> 2.3.0 - devtools-protocol: 0.0.1299070 -> 0.0.1312386 - debug: ^4.3.5 -> ^4.3.6 - Bumps @cloudflare/puppeteer version to 1.0.7 - Updates README to reflect upstream version 22.15.0 Key upstream changes included: - feat: support AbortSignal in waitForNavigation - fix: roll to Chrome 127.0.6533.88 - refactor: remove EventSubscription - Various bug fixes and improvements
ebeeaf2 to
235e9b9
Compare
What kind of change does this PR introduce?
Did you add tests for your changes?
If relevant, did you update the documentation?
Summary
Does this PR introduce a breaking change?
Other information