Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 395f523

Browse files
committed
JS: Port barriers in UrlConcatenation.qll
1 parent 7a1aead commit 395f523

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,16 @@ predicate hostnameSanitizingPrefixEdge(DataFlow::Node source, DataFlow::Node sin
103103
class HostnameSanitizerGuard extends TaintTracking::SanitizerGuardNode, StringOps::StartsWith {
104104
HostnameSanitizerGuard() { hasHostnameSanitizingSubstring(this.getSubstring()) }
105105

106-
override predicate sanitizes(boolean outcome, Expr e) {
106+
override predicate sanitizes(boolean outcome, Expr e) { this.blocksExpr(outcome, e) }
107+
108+
/** Holds if this node blocks flow through `e`, provided it evaluates to `outcome`. */
109+
predicate blocksExpr(boolean outcome, Expr e) {
107110
outcome = this.getPolarity() and
108111
e = this.getBaseString().asExpr()
109112
}
110113
}
114+
115+
/**
116+
* A check that sanitizes the hostname of a URL.
117+
*/
118+
module HostnameSanitizerGuard = DataFlow::MakeBarrierGuard<HostnameSanitizerGuard>;

0 commit comments

Comments
 (0)