Skip to content

Commit 807bb7d

Browse files
committed
[grid] Adding remote-allow-origins for Chrome stereotypes
Also fixes #11750
1 parent e91152f commit 807bb7d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

java/src/org/openqa/selenium/chrome/ChromeDriverInfo.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package org.openqa.selenium.chrome;
1919

2020
import com.google.auto.service.AutoService;
21+
import com.google.common.collect.ImmutableList;
22+
import com.google.common.collect.ImmutableMap;
2123

2224
import org.openqa.selenium.Capabilities;
2325
import org.openqa.selenium.ImmutableCapabilities;
@@ -43,7 +45,14 @@ public String getDisplayName() {
4345

4446
@Override
4547
public Capabilities getCanonicalCapabilities() {
46-
return new ImmutableCapabilities(CapabilityType.BROWSER_NAME, CHROME.browserName());
48+
// Allowing any origin "*" through remote-allow-origins might sound risky but an attacker
49+
// would need to know the port used to start DevTools to establish a connection. Given
50+
// these sessions are relatively short-lived, the risk is reduced. Also, this will be
51+
// removed when we only support Java 11 and above.
52+
return new ImmutableCapabilities(
53+
CapabilityType.BROWSER_NAME, CHROME.browserName(),
54+
ChromeOptions.CAPABILITY,
55+
ImmutableMap.of("args", ImmutableList.of("--remote-allow-origins=*")));
4756
}
4857

4958
@Override

0 commit comments

Comments
 (0)