mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
Python: Limit self argument for PotentialLibraryCall
Using the object from `MethodCallNode` meant that in the code below, `lib` from the import expression would be considered a self argument (this showed up in dataflow-consistency query results, that were not comitted... sorry) ``` from lib import func func() ```
This commit is contained in:
@@ -1311,7 +1311,7 @@ class PotentialLibraryCall extends ExtractedDataFlowCall, TPotentialLibraryCall
|
||||
// potential self argument, from `foo.bar()` -- note that this could also just be a
|
||||
// module reference, but we really don't have a good way of knowing :|
|
||||
apos.isSelf() and
|
||||
result = any(MethodCallNode mc | mc.getFunction().asCfgNode() = call.getFunction()).getObject()
|
||||
result.asCfgNode() = call.getFunction().(AttrNode).getObject()
|
||||
}
|
||||
|
||||
override ControlFlowNode getNode() { result = call }
|
||||
|
||||
@@ -348,7 +348,7 @@ class ExtractedArgumentNode extends ArgumentNode {
|
||||
normalCallArg(_, this, _)
|
||||
or
|
||||
// and self arguments
|
||||
this = any(MethodCallNode mc).getObject()
|
||||
this.asCfgNode() = any(CallNode c).getFunction().(AttrNode).getObject()
|
||||
}
|
||||
|
||||
final override predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
|
||||
|
||||
Reference in New Issue
Block a user