Skip to content

Commit 4f35a62

Browse files
committed
Python: broaden search for imports
This now finds vulnerabilities in github/field-security-codeql#100
1 parent d9854eb commit 4f35a62

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

python/ql/lib/semmle/python/Module.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,10 @@ private predicate isNameSpacePackage(Folder f, string name) {
254254
legalShortName(name) and
255255
name = f.getStem() and
256256
not isRegularPackage(f, name) and
257-
// it has to be imported in this folder
257+
// it has to be imported in a file
258+
// either in this folder or next to this folder
258259
name =
259-
any(ImportExpr i | i.getLocation().getFile().getParent() = f)
260+
any(ImportExpr i | i.getLocation().getFile().getParent() in [f, f.getParent()])
260261
.getName()
261262
.regexpReplaceAll("\\..*", "") and
262263
name != "" and

0 commit comments

Comments
 (0)