Selecting an object for on which a particular function is never called #722
Replies: 1 comment 3 replies
-
Thank you for your question! From your description, it sounds like you should be able model this using a data-flow query. Basically, what I would propose is a setup where your sources are the objects you're interested in, and your sinks are calls to the In that case, the sources that have flow to some sink will be exactly (or at least roughly) the complement of the set of objects you're interested in, and so if you look for sources that don't have flow to a sink, then these should be (again, roughly) what you're looking for. You can find some documentation on how to set up data-flow queries here (unfortunately we don't appear to have any documentation for Go specifically, but the data-flow library is shared between many of the languages, and the Java version of the docs is hopefully sufficient 🙂). |
Beta Was this translation helpful? Give feedback.
-
Hi!
I am new to codeQL, pretty impressed and excited about using it :) But being a beginner, I am facing some problems.
I am attempting to select all objects (of a certain kind) on which a particular member function function
validate
is never called. The problem is that I do not know how to indicate that I am looking for an object (the same object, regardless of through how many functions it passed in between its initialization and a call ).If I attempted to achieve the opposite (to find all those objects when that validation function is called), I do it by
But this works because here the difference between an object and its particular usage in the dataflow does not matter.
What I attempted to do so far was
But the result of it are all the
obj
nodes for whichvalidate
was not called (even if it was called on the same object, but in a deeper function).Let me know if I could provide any more information or details on what I am trying to accomplish.
(I am analyzing golang code)
Beta Was this translation helpful? Give feedback.
All reactions