Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
38acea6
Python: Dataflow, expand callable to classes
yoff Jul 27, 2020
eab64f1
Python: Dataflow, start on test for classes
yoff Jul 28, 2020
488a7f4
Python: update test expectations
yoff Jul 28, 2020
d32e277
Python: some doc, a generator, and a corotuine
yoff Jul 29, 2020
d7c08f7
Merge branch 'master' of github.com:github/codeql into SharedDataflow…
yoff Aug 4, 2020
81ad455
Python: full list of magic methods to be tested
yoff Aug 5, 2020
a896246
Python: format ql
yoff Aug 5, 2020
e642808
Update python/ql/test/experimental/dataflow/coverage/classes.py
yoff Aug 5, 2020
614103c
Python: Test calls rather than flows
yoff Aug 6, 2020
3db1cee
Python: format ql
yoff Aug 6, 2020
d84294d
Python: Check that tests are valid
yoff Aug 7, 2020
aff4535
Python: fix tests for descriptors
yoff Aug 7, 2020
f6d6f91
Python: tests for containers
yoff Aug 7, 2020
5b7c7f9
Python: tests for numeric classes
yoff Aug 7, 2020
0247877
Python: tests for context managers
yoff Aug 10, 2020
639d914
Python: test Awaitable, framework for async test
yoff Aug 10, 2020
959c631
Python: update reference to fix tests
yoff Aug 10, 2020
a963f15
Python: format strings are unnecessary and mess up
yoff Aug 10, 2020
5da37f5
Python: Update test expectations
yoff Aug 10, 2020
681657f
Merge branch 'master' of github.com:github/codeql into SharedDataflow…
yoff Aug 11, 2020
3929e01
Python: tests for async iterators/context managers
yoff Aug 11, 2020
12dfc4a
Python: clean up validity check code
yoff Aug 11, 2020
2c5de7f
Python: fix r/l confusion
yoff Aug 11, 2020
f834d71
Python: split out data model tests
yoff Aug 11, 2020
3949911
Python: Update test expectations
yoff Aug 11, 2020
dd4d002
Python: remaining class tests
yoff Aug 11, 2020
4b336e9
Update python/ql/test/experimental/dataflow/coverage/classes.py
yoff Aug 14, 2020
8d49ad7
Update python/ql/test/experimental/dataflow/coverage/datamodel.py
yoff Aug 14, 2020
9556937
Python: address review comments
yoff Aug 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion python/ql/src/experimental/dataflow/internal/DataFlowPrivate.qll
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,65 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
//--------
// Global flow
//--------
/**
* IPA type for DataFlowCallable.
* A callable is either a callable value or a class.
*/
newtype TDataFlowCallable =
TCallableValue(CallableValue callable) or
TClassValue(ClassValue c)

/** Represents a callable */
class DataFlowCallable = CallableValue;
abstract class DataFlowCallable extends TDataFlowCallable {
/** Gets a textual representation of this element. */
abstract string toString();

/** Gets a call to this callable. */
abstract CallNode getACall();

/** Gets the scope of this callable */
abstract Scope getScope();

/** Gets the specified parameter of this callable */
abstract NameNode getParameter(int n);

/** Gets the name of this callable. */
abstract string getName();
}

class DataFlowCallableValue extends DataFlowCallable, TCallableValue {
CallableValue callable;

DataFlowCallableValue() { this = TCallableValue(callable) }

override string toString() { result = callable.toString() }

override CallNode getACall() { result = callable.getACall() }

override Scope getScope() { result = callable.getScope() }

override NameNode getParameter(int n) { result = callable.getParameter(n) }

override string getName() { result = callable.getName() }
}

class DataFlowClassValue extends DataFlowCallable, TClassValue {
ClassValue c;

DataFlowClassValue() { this = TClassValue(c) }

override string toString() { result = c.toString() }

override CallNode getACall() { result = c.getACall() }

override Scope getScope() { result = c.getScope() }

override NameNode getParameter(int n) {
result.getNode() = c.getScope().getInitMethod().getArg(n + 1).asName()
}

override string getName() { result = c.getName() }
}

/** Represents a call to a callable */
class DataFlowCall extends CallNode {
Expand Down
2 changes: 1 addition & 1 deletion python/ql/test/experimental/dataflow/basic/callGraph.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import callGraphConfig
import experimental.dataflow.callGraphConfig

from DataFlow::Node source, DataFlow::Node sink
where exists(CallGraphConfig cfg | cfg.hasFlow(source, sink))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import callGraphConfig
import experimental.dataflow.callGraphConfig

from DataFlow::Node sink
where exists(CallGraphConfig cfg | cfg.isSink(sink))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import callGraphConfig
import experimental.dataflow.callGraphConfig

from DataFlow::Node source
where exists(CallGraphConfig cfg | cfg.isSource(source))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ argHasPostUpdate
| test.py:74:17:74:17 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
| test.py:81:13:81:13 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
| test.py:86:13:86:13 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
| test.py:158:15:158:15 | ControlFlowNode for l | ArgumentNode is missing PostUpdateNode. |
| test.py:159:15:159:15 | ControlFlowNode for d | ArgumentNode is missing PostUpdateNode. |
Loading