17
17
package org .openqa .selenium .edge ;
18
18
19
19
import com .google .auto .service .AutoService ;
20
+ import com .google .common .collect .ImmutableList ;
21
+ import com .google .common .collect .ImmutableMap ;
20
22
21
23
import org .openqa .selenium .Capabilities ;
22
24
import org .openqa .selenium .ImmutableCapabilities ;
25
27
import org .openqa .selenium .WebDriverException ;
26
28
import org .openqa .selenium .WebDriverInfo ;
27
29
import org .openqa .selenium .chromium .ChromiumDriverInfo ;
30
+ import org .openqa .selenium .remote .CapabilityType ;
28
31
import org .openqa .selenium .remote .service .DriverFinder ;
29
32
30
33
import java .util .Optional ;
31
34
32
35
import static org .openqa .selenium .remote .Browser .EDGE ;
33
- import static org .openqa .selenium .remote .CapabilityType .BROWSER_NAME ;
34
36
35
37
@ AutoService (WebDriverInfo .class )
36
38
public class EdgeDriverInfo extends ChromiumDriverInfo {
@@ -42,7 +44,14 @@ public String getDisplayName() {
42
44
43
45
@ Override
44
46
public Capabilities getCanonicalCapabilities () {
45
- return new ImmutableCapabilities (BROWSER_NAME , EDGE .browserName ());
47
+ // Allowing any origin "*" through remote-allow-origins might sound risky but an attacker
48
+ // would need to know the port used to start DevTools to establish a connection. Given
49
+ // these sessions are relatively short-lived, the risk is reduced. Also, this will be
50
+ // removed when we only support Java 11 and above.
51
+ return new ImmutableCapabilities (
52
+ CapabilityType .BROWSER_NAME , EDGE .browserName (),
53
+ EdgeOptions .CAPABILITY ,
54
+ ImmutableMap .of ("args" , ImmutableList .of ("--remote-allow-origins=*" )));
46
55
}
47
56
48
57
@ Override
0 commit comments