Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code

71,560

Solution 1

I could not pass any parameters to chromedriver from p@gc - Chrome Driver Config directly, my config looks like:

chromedriver config

where my chromedriver.dir was chromedirver.dir=vu.chromedriver.dir=/path/to/chromedriver However, I was able to work around it by adding:

  1. workaround.sh for macOS

    #!/usr/bin/env bash /path/to/chromedriver --whitelist-ip $*

  2. workaround.bat for Windows

    \\src\\path\\to\\chromedriver.exe --whitelist-ip %*

And that solved my issue for making chromedriver to accept remote connections.

Solution 2

lease protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

Solution: Get your Chrome Browser version and download the ChromeDriver for specific to that version.

Open your Chrome browser > Click on 3 vertical dots (top right corner) > Help > About Google Chrome

Verify the Chrome Version (such as 73 or 74 or other ..)

goto Selenium browser driver download portal and download the Chrome Driver of that version

https://sites.google.com/a/chromium.org/chromedriver/downloads

Share:
71,560
Awad
Author by

Awad

Full Stack Application Developer with 4+ years of hands on experience in Java enterprise application development using Java, JEE, MySQL, NoSQL, Spring, and Hibernate as well as Java Web Services such as REST and SOAP during all phases of SDLC. Develop UI pages using HTML5, CSS3, Angular2, BootStrap, JavaScript, jQuery, and AJAX. Demonstrate analysis, coding, and debugging skills with ability to rapidly adapt to new technical environments. Proven communication skills while interacting effectively with managers, colleagues, and clients My technical portfolio includes abilities in Java, Angular2, Node.js, Express, SQL, JavaScript, HTML, CSS, Ajax, and JSON

Updated on July 09, 2022

Comments

  • Awad
    Awad almost 2 years

    I am trying to run a Jmeter test on remote machine ( macOS sierraO). I configured jp@gc - Chrome Driver Config and I can connect to the slave machine. However, whenever I try to run it I get

    Starting ChromeDriver 73.0.3683.20 (XXXXXXX) on port XXXX
    Only local connections are allowed.
    Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
    Mar 08, 2019 12:12:35 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: OSS
    Using local port: XXXXXX
    2019-03-08 13:04:39.171 java[10402:23852395] IMKInputSession [0x7f8bcbaaf740 presentFunctionRowItemTextInputViewWithEndpoint:completionHandler:] : [self textInputContext]=0x7f8bcbb578f0 *NO* NSRemoteViewController to client, NSError=Error Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 0 was invalidated from this process." UserInfo={NSDebugDescription=The connection from pid 0 was invalidated from this process.}, com.apple.inputmethod.EmojiFunctionRowItem
    

    I know this is related to the security consideration, but I couldn't find a way to solve for my use case.

    My use case is: I am running jmeter test using:

    1. Run remote server directly from Jmeter 5.1
    2. Run using java-maven-plugin project.

    Any thoughts how to configure chromeDriver to run on remote server would be appreciated.

  • Awad
    Awad about 5 years
    For distributed testing, and kicking off webdriver's chrome it won't work.
  • siddharta
    siddharta almost 5 years
    I had the same error and fixed by synching my ChromeDriver version with the installed Chrome version, not sure if is the same issue, but worth the shot
  • origds
    origds almost 5 years
    Where did you add the file "workoaround.sh"? I'm trying to do the same but I don't know where to put the sh file to execute it. Thank you in advance.
  • Awad
    Awad almost 5 years
    It doesn't really matter, just make sure the new ${chromedriver.dir} = /path/to/workaround.sh. You can just add it to the script directory.