mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Python: Tarslip query: Fix up sanitizers.
This commit is contained in:
@@ -90,6 +90,8 @@ class ExcludeTarFilePy extends Sanitizer {
|
||||
taint instanceof OpenTarFile
|
||||
or
|
||||
taint instanceof TarFileInfo
|
||||
or
|
||||
taint.(SequenceKind).getItem() instanceof TarFileInfo
|
||||
)
|
||||
}
|
||||
|
||||
@@ -162,9 +164,9 @@ class TarFileInfoSanitizer extends Sanitizer {
|
||||
|
||||
private predicate path_sanitizing_test(ControlFlowNode test) {
|
||||
/* Assume that any test with "path" in it is a sanitizer */
|
||||
test.getAChild+().(AttrNode).getName() = "path"
|
||||
test.getAChild+().(AttrNode).getName().matches("%path")
|
||||
or
|
||||
test.getAChild+().(NameNode).getId() = "path"
|
||||
test.getAChild+().(NameNode).getId().matches("%path")
|
||||
}
|
||||
|
||||
class TarSlipConfiguration extends TaintTracking::Configuration {
|
||||
|
||||
@@ -5,7 +5,7 @@ import semmle.python.security.TaintTracking
|
||||
query predicate edges(TaintedNode fromnode, TaintedNode tonode) {
|
||||
fromnode.getASuccessor() = tonode and
|
||||
/* Don't record flow past sinks */
|
||||
not fromnode.isVulnerableSink()
|
||||
not fromnode.isSink()
|
||||
}
|
||||
|
||||
private TaintedNode first_child(TaintedNode parent) {
|
||||
|
||||
Reference in New Issue
Block a user