mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Python: Add prefix sanitizer on URL redirect query
This doesn't cover 100% of what we want to, but matches what we used to.
This commit is contained in:
@@ -22,6 +22,15 @@ class UrlRedirectConfiguration extends TaintTracking::Configuration {
|
||||
sink = any(HTTP::Server::HttpRedirectResponse e).getRedirectLocation()
|
||||
}
|
||||
|
||||
override predicate isSanitizer(DataFlow::Node node) {
|
||||
// Url redirection is a problem only if the user controls the prefix of the URL.
|
||||
// This is a copy of the taint-sanitizer from the old points-to query, which doesn't
|
||||
// cover formatting.
|
||||
exists(BinaryExprNode string_concat | string_concat.getOp() instanceof Add |
|
||||
string_concat.getRight() = node.asCfgNode()
|
||||
)
|
||||
}
|
||||
|
||||
override predicate isSanitizerGuard(DataFlow::BarrierGuard guard) {
|
||||
guard instanceof StringConstCompare
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user