Skip to content

Commit 17300dd

Browse files
committed
Python: Make ExtractedArgumentNode local
Explicitly adds a bunch of nodes that were previously (using a global analysis) identified as `ExtractedArgumentNode`s.
1 parent b0e94e8 commit 17300dd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,17 @@ abstract class ArgumentNode extends Node {
344344
*/
345345
class ExtractedArgumentNode extends ArgumentNode {
346346
ExtractedArgumentNode() {
347-
// for resolved calls, we need to allow all argument nodes
348-
getCallArg(_, _, _, this, _)
347+
// pre-update nodes for calls
348+
this = any(CallCfgNode c).(PostUpdateNode).getPreUpdateNode()
349+
or
350+
// self parameters in methods
351+
exists(Class c | this.asExpr() = c.getAMethod().getArg(0))
352+
or
353+
// the object part of an attribute expression (which might be a bound method)
354+
this.asCfgNode() = any(AttrNode a).getObject()
355+
or
356+
// the function part of any call
357+
this.asCfgNode() = any(CallNode c).getFunction()
349358
or
350359
// for potential summaries we allow all normal call arguments
351360
normalCallArg(_, this, _)

0 commit comments

Comments
 (0)