File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
lib/semmle/python/frameworks
test/query-tests/Security/CWE-078-UnsafeShellCommandConstruction Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,12 @@ module Setuptools {
19
19
* Gets a file or folder that is exported by a library.
20
20
*/
21
21
private Container getALibraryExportedContainer ( ) {
22
- result = setupFile ( ) .getParent ( )
22
+ // a child folder of the root that has a setup.py file
23
+ result = setupFile ( ) .getParent ( ) .( Folder ) .getAFolder ( ) and
24
+ // where the folder has __init__.py file
25
+ exists ( result .( Folder ) .getFile ( "__init__.py" ) ) and
26
+ // and is not a test folder
27
+ not result .( Folder ) .getBaseName ( ) = [ "test" , "tests" , "testing" ]
23
28
or
24
29
// child of a library exported container
25
30
result = getALibraryExportedContainer ( ) .getAChildContainer ( ) and
@@ -29,9 +34,7 @@ module Setuptools {
29
34
or
30
35
// or a folder with an __init__.py file
31
36
exists ( result .( Folder ) .getFile ( "__init__.py" ) )
32
- ) and
33
- // that is not a test folder
34
- not result .( Folder ) .getBaseName ( ) = [ "test" , "tests" , "testing" ]
37
+ )
35
38
}
36
39
37
40
/**
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ def unsafe_setup (name ):
4
+ os .system ("ping " + name ) # $result=OK - this is inside a setyp script, so it's fine.
You can’t perform that action at this time.
0 commit comments