@@ -38,8 +38,9 @@ module StaticCreation {
38
38
// Some CDN URLs are required to have an integrity attribute. We only add CDNs to that list
39
39
// that recommend integrity-checking.
40
40
exists ( string hostname , string requiredCheckingHostname |
41
- hostname = url .regexpCapture ( "(?i)^(?:https?:)?//([^/]+)/.*\\.js$" , 1 )
42
- and isCdnDomainWithCheckingRequired ( requiredCheckingHostname ) and hostname = requiredCheckingHostname
41
+ hostname = url .regexpCapture ( "(?i)^(?:https?:)?//([^/]+)/.*\\.js$" , 1 ) and
42
+ isCdnDomainWithCheckingRequired ( requiredCheckingHostname ) and
43
+ hostname = requiredCheckingHostname
43
44
)
44
45
}
45
46
@@ -87,23 +88,22 @@ module StaticCreation {
87
88
bindingset [ url]
88
89
predicate isUrlWithUntrustedDomain ( string url ) {
89
90
exists ( string hostname |
90
- hostname = url .regexpCapture ( "(?i)^(?:https?:)?//([^/]+)/.*" , 1 )
91
- and isUntrustedHostname ( hostname )
91
+ hostname = url .regexpCapture ( "(?i)^(?:https?:)?//([^/]+)/.*" , 1 ) and
92
+ isUntrustedHostname ( hostname )
92
93
)
93
94
}
94
95
95
96
/** Holds if `hostname` refers to a domain or subdomain that is untrusted. */
96
97
bindingset [ hostname]
97
98
predicate isUntrustedHostname ( string hostname ) {
98
99
exists ( string domain |
99
- ( hostname = domain or hostname .matches ( "%." + domain ) ) and
100
+ ( hostname = domain or hostname .matches ( "%." + domain ) ) and
100
101
isUntrustedDomain ( domain )
101
102
)
102
103
}
103
104
104
105
// The following predicates are extended in data extensions under javascript/ql/lib/semmle/javascript/security/domains/
105
106
// and can be extended with custom model packs as necessary.
106
-
107
107
/** Holds for hostnames defined in data extensions */
108
108
extensible predicate isCdnDomainWithCheckingRequired ( string hostname ) ;
109
109
0 commit comments