mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
move LocalUrlSanitizingGuard out of the customizations file
This commit is contained in:
@@ -47,20 +47,6 @@ module ServerSideUrlRedirect {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to a function called `isLocalUrl` or similar, which is
|
||||
* considered to sanitize a variable for purposes of URL redirection.
|
||||
*/
|
||||
class LocalUrlSanitizingGuard extends TaintTracking::SanitizerGuardNode, DataFlow::CallNode {
|
||||
LocalUrlSanitizingGuard() { this.getCalleeName().regexpMatch("(?i)(is_?)?local_?url") }
|
||||
|
||||
override predicate sanitizes(boolean outcome, Expr e) {
|
||||
// `isLocalUrl(e)` sanitizes `e` if it evaluates to `true`
|
||||
this.getAnArgument().asExpr() = e and
|
||||
outcome = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A URL attribute for a React Native `WebView`.
|
||||
*/
|
||||
|
||||
@@ -36,3 +36,17 @@ class Configuration extends TaintTracking::Configuration {
|
||||
guard instanceof HostnameSanitizerGuard
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to a function called `isLocalUrl` or similar, which is
|
||||
* considered to sanitize a variable for purposes of URL redirection.
|
||||
*/
|
||||
class LocalUrlSanitizingGuard extends TaintTracking::SanitizerGuardNode, DataFlow::CallNode {
|
||||
LocalUrlSanitizingGuard() { this.getCalleeName().regexpMatch("(?i)(is_?)?local_?url") }
|
||||
|
||||
override predicate sanitizes(boolean outcome, Expr e) {
|
||||
// `isLocalUrl(e)` sanitizes `e` if it evaluates to `true`
|
||||
this.getAnArgument().asExpr() = e and
|
||||
outcome = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user