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 {
1919 * Gets a file or folder that is exported by a library.
2020 */
2121 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" ]
2328 or
2429 // child of a library exported container
2530 result = getALibraryExportedContainer ( ) .getAChildContainer ( ) and
@@ -29,9 +34,7 @@ module Setuptools {
2934 or
3035 // or a folder with an __init__.py file
3136 exists ( result .( Folder ) .getFile ( "__init__.py" ) )
32- ) and
33- // that is not a test folder
34- not result .( Folder ) .getBaseName ( ) = [ "test" , "tests" , "testing" ]
37+ )
3538 }
3639
3740 /**
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