Skip to content

Commit ca7b69e

Browse files
committed
NEVER MERGE: Ensure we don't use site-packages stuff
1 parent de2a563 commit ca7b69e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

python/ql/lib/semmle/python/ApiGraphs.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ module API {
838838
// Subclassing a node
839839
lbl = Label::subclass() and
840840
exists(PY::ClassExpr clsExpr, DataFlow::Node superclass | pred.flowsTo(superclass) |
841+
exists(clsExpr.getLocation().getFile().getRelativePath()) and
841842
clsExpr.getABase() = superclass.asExpr() and
842843
// Potentially a class decorator could do anything, but we assume they are
843844
// "benign" and let subclasses edges flow through anyway.

python/ql/lib/semmle/python/dataflow/new/internal/LocalSources.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ private import semmle.python.dataflow.new.internal.ImportStar
3636
class LocalSourceNode extends Node {
3737
cached
3838
LocalSourceNode() {
39+
exists(this.getLocation().getFile().getRelativePath()) and (
3940
Stages::DataFlow::ref() and
4041
this instanceof ExprNode and
4142
not simpleLocalFlowStepForTypetracking(_, this)
@@ -72,6 +73,7 @@ class LocalSourceNode extends Node {
7273
// We include all scope entry definitions, as these act as the local source within the scope they
7374
// enter.
7475
this.asCfgNode() = any(ScopeEntryDefinition def).getDefiningNode()
76+
)
7577
}
7678

7779
/** Holds if this `LocalSourceNode` can flow to `nodeTo` in one or more local flow steps. */

0 commit comments

Comments
 (0)