Skip to content

Commit 0d79c71

Browse files
committed
JS: Update two more uses of SanitizerGuardNode
1 parent 62c17d3 commit 0d79c71

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/ServerSideUrlRedirectQuery.qll

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,22 @@ deprecated class Configuration extends TaintTracking::Configuration {
7070
* A call to a function called `isLocalUrl` or similar, which is
7171
* considered to sanitize a variable for purposes of URL redirection.
7272
*/
73-
class LocalUrlSanitizingGuard extends TaintTracking::SanitizerGuardNode, DataFlow::CallNode {
73+
class LocalUrlSanitizingGuard extends DataFlow::CallNode {
7474
LocalUrlSanitizingGuard() { this.getCalleeName().regexpMatch("(?i)(is_?)?local_?url") }
7575

76-
override predicate sanitizes(boolean outcome, Expr e) { this.blocksExpr(outcome, e) }
76+
/** DEPRECATED. Use `blocksExpr` instead. */
77+
deprecated predicate sanitizes(boolean outcome, Expr e) { this.blocksExpr(outcome, e) }
7778

7879
/** Holds if this node blocks flow through `e`, provided it evaluates to `outcome`. */
7980
predicate blocksExpr(boolean outcome, Expr e) {
8081
this.getAnArgument().asExpr() = e and
8182
outcome = true
8283
}
8384
}
85+
86+
deprecated private class LocalUrlSanitizingGuardLegacy extends TaintTracking::SanitizerGuardNode instanceof LocalUrlSanitizingGuard
87+
{
88+
override predicate sanitizes(boolean outcome, Expr e) {
89+
LocalUrlSanitizingGuard.super.sanitizes(outcome, e)
90+
}
91+
}

javascript/ql/lib/semmle/javascript/security/dataflow/UrlConcatenation.qll

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ predicate hostnameSanitizingPrefixEdge(DataFlow::Node source, DataFlow::Node sin
100100
/**
101101
* A check that sanitizes the hostname of a URL.
102102
*/
103-
class HostnameSanitizerGuard extends TaintTracking::SanitizerGuardNode, StringOps::StartsWith {
103+
class HostnameSanitizerGuard extends StringOps::StartsWith {
104104
HostnameSanitizerGuard() { hasHostnameSanitizingSubstring(this.getSubstring()) }
105105

106-
override predicate sanitizes(boolean outcome, Expr e) { this.blocksExpr(outcome, e) }
106+
/** DEPRECATED. Use `blocksExpr` instead. */
107+
deprecated predicate sanitizes(boolean outcome, Expr e) { this.blocksExpr(outcome, e) }
107108

108109
/** Holds if this node blocks flow through `e`, provided it evaluates to `outcome`. */
109110
predicate blocksExpr(boolean outcome, Expr e) {
@@ -112,6 +113,13 @@ class HostnameSanitizerGuard extends TaintTracking::SanitizerGuardNode, StringOp
112113
}
113114
}
114115

116+
deprecated private class HostnameSanitizerGuardLegacy extends TaintTracking::SanitizerGuardNode instanceof HostnameSanitizerGuard
117+
{
118+
override predicate sanitizes(boolean outcome, Expr e) {
119+
HostnameSanitizerGuard.super.sanitizes(outcome, e)
120+
}
121+
}
122+
115123
/**
116124
* A check that sanitizes the hostname of a URL.
117125
*/

0 commit comments

Comments
 (0)