File tree Expand file tree Collapse file tree
python/ql/src/semmle/python Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -212,8 +212,15 @@ private string moduleNameFromBase(Container file) {
212212private predicate transitively_imported_from_entry_point ( File file ) {
213213 file .getExtension ( ) .matches ( "%py%" ) and
214214 exists ( File importer |
215+ // Only consider files that are in the source archive
216+ exists ( importer .getRelativePath ( ) ) and
215217 importer .getParent ( ) = file .getParent ( ) and
216- exists ( ImportExpr i | i .getLocation ( ) .getFile ( ) = importer and i .getName ( ) = file .getStem ( ) )
218+ exists ( ImportExpr i |
219+ i .getLocation ( ) .getFile ( ) = importer and
220+ i .getName ( ) = file .getStem ( ) and
221+ // Disregard relative imports
222+ i .getLevel ( ) = 0
223+ )
217224 |
218225 importer .isPossibleEntryPoint ( ) or transitively_imported_from_entry_point ( importer )
219226 )
You can’t perform that action at this time.
0 commit comments