Skip to content

Python: From an Argument to a Parameter #13590

Answered by aeisenberg
Sim4n6 asked this question in Q&A
Discussion options

You must be logged in to vote

If f() is a library defined in the current program (not in a third party library), then the dataflow should be connected. Can you share a query that you are writing as well as a snippet of code that should be working?

I wrote this simple python script and query and the result was found. Are you trying to do something different?

class Obj:
  def m(self, a):
    print(a)

def f1():
  return Obj()

a = 1

obj1 = f1()
obj1.m(a)
import python
import semmle.python.dataflow.new.DataFlow

class SampleConfiguration extends DataFlow::Configuration {
  SampleConfiguration() { this = "sample" }

  override predicate isSource(DataFlow::Node source) {
    source.asExpr() instanceof IntegerLiteral
  }

  

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Sim4n6
Comment options

@Sim4n6
Comment options

Answer selected by Sim4n6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Python awaiting-response The CodeQL team is awaiting further input or clarification from the original reporter of this issue.
2 participants