Skip to content

Commit 0aab2ae

Browse files
committed
Formatting of QLL
1 parent dae2aeb commit 0aab2ae

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

javascript/ql/lib/semmle/javascript/security/FunctionalityFromUntrustedSource.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ module StaticCreation {
3838
// Some CDN URLs are required to have an integrity attribute. We only add CDNs to that list
3939
// that recommend integrity-checking.
4040
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
4344
)
4445
}
4546

@@ -87,23 +88,22 @@ module StaticCreation {
8788
bindingset[url]
8889
predicate isUrlWithUntrustedDomain(string url) {
8990
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)
9293
)
9394
}
9495

9596
/** Holds if `hostname` refers to a domain or subdomain that is untrusted. */
9697
bindingset[hostname]
9798
predicate isUntrustedHostname(string hostname) {
9899
exists(string domain |
99-
(hostname = domain or hostname.matches("%." + domain)) and
100+
(hostname = domain or hostname.matches("%." + domain)) and
100101
isUntrustedDomain(domain)
101102
)
102103
}
103104

104105
// The following predicates are extended in data extensions under javascript/ql/lib/semmle/javascript/security/domains/
105106
// and can be extended with custom model packs as necessary.
106-
107107
/** Holds for hostnames defined in data extensions */
108108
extensible predicate isCdnDomainWithCheckingRequired(string hostname);
109109

0 commit comments

Comments
 (0)