rod icon indicating copy to clipboard operation
rod copied to clipboard

Insufficient "Exists" heuristics / error detection for Chromium

Open Skyr opened this issue 3 years ago • 0 comments
trafficstars

Rod Version: v0.109.3 (master)

rod checks the successful download of Chromium by executing it and parsing the result of the about:empty page: https://github.com/go-rod/rod/blob/master/lib/launcher/browser.go#L268 On my (Linux, remote, headless) system, several GUI shared libraries were missing:

./chrome --headless --no-sandbox --disable-gpu --dump-dom about:blank
./chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory

This problem is not handled (and not shown) and caused the binaries to be re-downloaded on every start of the application.

Steps to reproduce (library path on Debian):

/usr/lib/x86_64-linux-gnu# mkdir x ; mv libcairo* x/

$ cd ~/.cache/rod/browser/*/chrome-linux
$ ./chrome --headless --no-sandbox --disable-gpu --dump-dom about:blank
./chrome: error while loading shared libraries: libcairo.so.2: cannot open shared object file: No such file or directory

$ nuclei -v -validate
                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   2.7.7

                projectdiscovery.io

[WRN] Use with caution. You are responsible for your actions.
[WRN] Developers assume no liability and are not responsible for any misuse or damage.
[launcher.Browser]2022/09/12 11:14:21 try to find the fastest host to download the browser binary
[launcher.Browser]2022/09/12 11:14:21 check https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1033860/chrome-linux.zip
[launcher.Browser]2022/09/12 11:14:21 check https://registry.npmmirror.com/-/binary/chromium-browser-snapshots/Linux_x64/1033860/chrome-linux.zip
[launcher.Browser]2022/09/12 11:14:21 check https://playwright.azureedge.net/builds/chromium/1033860/chromium-linux-arm64.zip
^C

/usr/lib/x86_64-linux-gnu# mv x/* . ; rmdir x

A possible solution:

  • "Exists" check should simply check for the existence of the binary
  • Actual execution should watch for problems starting the binary and give an appropriate output / return

Skyr avatar Sep 12 '22 08:09 Skyr