Skip to content

Commit 421d4f3

Browse files
committed
Python: filter more sinks in stdlib
Rename variable to reflect larger scope We had test results inside `os.py`, I suppose we have found a little extra flow.
1 parent 11c71fd commit 421d4f3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

python/ql/lib/semmle/python/security/dataflow/PathInjectionCustomizations.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ module PathInjection {
7171
// ```
7272
//
7373
// The same approach is used in the command injection query.
74-
not exists(Module pathlib |
75-
pathlib.getName() = "pathlib" and
76-
this.getScope().getEnclosingModule() = pathlib and
77-
// do allow this call if we're analyzing pathlib.py as part of CPython though
78-
not exists(pathlib.getFile().getRelativePath())
74+
not exists(Module inStdlib |
75+
inStdlib.getName() in ["pathlib", "os"] and
76+
this.getScope().getEnclosingModule() = inStdlib and
77+
// do allow this call if we're analyzing, say, pathlib.py as part of CPython though
78+
not exists(inStdlib.getFile().getRelativePath())
7979
)
8080
}
8181
}

0 commit comments

Comments
 (0)