erik-krogh
8be7eadace
delete outdated deprecations
2024-01-22 09:11:35 +01:00
Rasmus Lerchedahl Petersen
da4aef80e9
Revert "Python: make it a real consistency check"
...
This reverts commit 45411f4a93 .
2023-12-20 16:15:17 +01:00
Rasmus Lerchedahl Petersen
d039ceb689
Python: add test for fields
2023-12-20 15:23:45 +01:00
Rasmus Lerchedahl Petersen
706e9dc896
Python: fix compilation
2023-12-20 15:23:33 +01:00
Rasmus Lerchedahl Petersen
45411f4a93
Python: make it a real consistency check
2023-12-20 14:53:37 +01:00
Rasmus Lerchedahl Petersen
f8417b0dd8
Merge branch 'main' of https://github.com/github/codeql into python/captured-variables-basic
2023-12-20 13:16:42 +01:00
Rasmus Lerchedahl Petersen
169d7a3c98
Python: Add scope entry definition nodes
...
otherwise we confuse captured variables
in the single scope entry cfg node. Now
we have one for each defined variable.
2023-12-20 12:09:00 +01:00
yoff
a60c52b8b7
Merge branch 'main' into python/captured-variables-basic
2023-12-18 23:44:46 +01:00
Rasmus Lerchedahl Petersen
78c484faab
Python: remove support for capturing callbacks
...
This will be added in a follow-up PR instead.
2023-12-18 23:24:57 +01:00
Rasmus Lerchedahl Petersen
64655a0ea8
Python: Use enw class name
2023-12-16 01:36:46 +01:00
Rasmus Lerchedahl Petersen
1ee11ae7af
Merge branch 'main' of https://github.com/github/codeql into python/captured-variables-basic
2023-12-15 14:31:57 +01:00
Tom Hvitved
3b1146bf98
Python: Adopt shared type tracking library
2023-12-14 13:22:44 +01:00
Tom Hvitved
c8b4a215bc
Merge pull request #14573 from hvitved/flow-summary-impl-param
...
Move `FlowSummaryImpl.qll` to `dataflow` pack
2023-12-14 12:24:15 +01:00
Rasmus Lerchedahl Petersen
479d81fb75
Python: fix nonlocal captured variables
...
This depends on the extractor fix
2023-12-14 10:37:27 +01:00
Rasmus Lerchedahl Petersen
17a0029585
Python: support callbacks to library calls
...
TODO:
The member predicate `LibraryLambdaMethod::getACall` is
currently too permissive.
Ideally, we would have `libraryCallHasLambdaArg`
as in Ruby. But even a more precise
`libraryCall` predicate might be fine.
2023-12-14 10:27:15 +01:00
Rasmus Lerchedahl Petersen
7565873e83
Python: test callbacks to library calls
2023-12-14 10:27:15 +01:00
Rasmus Lerchedahl Petersen
797deebcdd
Python: exclude CaptureNodes
2023-12-14 10:27:15 +01:00
Rasmus Lerchedahl Petersen
c054ba6a97
python: instantiate module for variable capture
...
This provides variable capture in standard situations:
- nested functions
- lambdas
There are some deficiencies:
- we do not yet handle objects capturing variables.
- we do not handle variables captured via the `nonlocal` keyword.
This should be solved at the AST level, though, and then it
should "just work".
There are still inconsistencies in the case where
a `SynthesizedCaptureNode` has a comprehensions
as its enclosing callable. In this case,
`TFunction(cn.getEnclosingCallable())` is not
defined and so getEnclosingCallable does not exist
for the `CaptureNode`.
2023-12-14 10:25:39 +01:00
Rasmus Lerchedahl Petersen
6db55cd12f
Python: add missing annotation
2023-12-14 10:20:49 +01:00
Rasmus Wriedt Larsen
419130be21
Merge pull request #15030 from yoff/python/remove-module-entry-definitions
...
Python: Remove control flow nodes for module entry definitions from the dataflow graph.
2023-12-11 11:40:17 +01:00
Tom Hvitved
faaa558ed9
Python: Use FlowSummaryImpl from dataflow pack
2023-12-10 11:25:44 +01:00
Anders Schack-Mulligen
64eb4ff753
Merge pull request #14983 from aschackmull/dataflow/deprecate-old-api
...
Data Flow: Deprecate old data flow api.
2023-12-08 14:27:25 +01:00
Rasmus Lerchedahl Petersen
263c0aade7
Python: adjust test expectations
...
mostly removing of nodes from the graph.
One result lost:
```
check("submodule.submodule_attr", submodule.submodule_attr, "submodule_attr", globals()) #$ MISSING:prints=submodule_attr
```
2023-12-06 23:00:51 +01:00
Rasmus Lerchedahl Petersen
9e1c818db6
Python: address review comments
2023-12-04 17:49:26 +01:00
yoff
f5c176bd12
Apply suggestions from code review
...
Co-authored-by: Taus <tausbn@github.com >
2023-12-04 17:41:00 +01:00
Rasmus Wriedt Larsen
c952f6a648
Python: Update rest of tests to new dataflow lib
...
I had missed these originally, since I had just fixed the ones that were
highlighted in the actions logs, thinking they had covered everything :(
2023-12-04 14:49:40 +01:00
Rasmus Lerchedahl Petersen
e091ae84ab
Merge branch 'main' of https://github.com/github/codeql into python/remove-ssa-nodes-from-dataflow-graph
2023-12-04 14:05:40 +01:00
Rasmus Wriedt Larsen
2fed0adde7
Merge pull request #8457 from RasmusWL/add-dataflow-consistency-query
...
Python: Add dataflow consistency query
2023-12-04 12:50:46 +01:00
Rasmus Wriedt Larsen
4dd3ea3798
Python: Update tests to new dataflow lib
...
Avoids some deprecation warnings :)
2023-12-04 12:36:57 +01:00
Rasmus Wriedt Larsen
3c82653b63
Python: Highlight missing post-update flow for *args and **kwargs
2023-11-28 10:59:48 +01:00
Rasmus Wriedt Larsen
d056706af5
Merge pull request #14725 from RasmusWL/re-modeling
...
Python: Add taint-flow modeling for `re` module
2023-11-23 11:35:36 +01:00
Rasmus Wriedt Larsen
30891ca4aa
Merge pull request #14861 from yoff/python/demonstrate-def-use-explosion
...
Python: test demonstrating the need for phi nodes
2023-11-22 09:57:10 +01:00
yoff
4785048076
Apply suggestions from code review
...
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com >
2023-11-22 09:29:07 +01:00
Rasmus Lerchedahl Petersen
d288c4a709
Python: rename folder
2023-11-21 16:48:41 +01:00
yoff
4f7fde7b87
Merge pull request #14858 from yoff/python/demonstrate-use-use-explosion
...
Python: Test demonstrating the need for phi-read-nodes
2023-11-21 16:44:11 +01:00
Rasmus Lerchedahl Petersen
c552bc5eb1
Python: fix test output
2023-11-21 15:48:22 +01:00
Rasmus Lerchedahl Petersen
077e51c6c6
Python: fix test output
2023-11-21 15:47:18 +01:00
Rasmus Lerchedahl Petersen
4857960f72
Python: test demonstrating the need for phi nodes
...
or a dataflow node playing that role, at least.
2023-11-21 15:40:05 +01:00
Rasmus Lerchedahl Petersen
f138fc0d2d
Python: Test demonstrating need for phi-read-nodes
...
Or for a data flow node filling that role, at least.
2023-11-21 13:54:02 +01:00
Rasmus Wriedt Larsen
df9fb141b8
Python: Remove old manual consistency query tests
2023-11-21 11:50:23 +01:00
Rasmus Lerchedahl Petersen
11c71fdd18
Python: remove EssaNodes
...
This commit removes SSA nodes from the data flow graph. Specifically, for a definition and use such as
```python
x = expr
y = x + 2
```
we used to have flow from `expr` to an SSA variable representing x and from that SSA variable to the use of `x` in the definition of `y`. Now we instead have flow from `expr` to the control flow node for `x` at line 1 and from there to the control flow node for `x` at line 2.
Specific changes:
- `EssaNode` from the data flow layer no longer exists.
- Several glue steps between `EssaNode`s and `CfgNode`s have been deleted.
- Entry nodes are now admitted as `CfgNodes` in the data flow layer (they were filtered out before).
- Entry nodes now have a new `toString` taking into account that the module name may be ambigous.
- Some tests have been rewritten to accomodate the changes, but only `python/ql/test/experimental/dataflow/basic/maximalFlowsConfig.qll` should have semantic changes.
- Comments have been updated
- Test output has been updated, but apart from `python/ql/test/experimental/dataflow/basic/maximalFlows.expected` only `python/ql/test/experimental/dataflow/typetracking-summaries/summaries.py` should have a semantic change. This is a bonus fix, probably meaning that something was never connected up correctly.
2023-11-20 21:35:32 +01:00
Rasmus Wriedt Larsen
db1499d5b0
Python: Add test for variable reference in list comprehension
2023-11-20 16:41:34 +01:00
Rasmus Wriedt Larsen
25d3af9236
Merge branch 'main' into clean-tests
2023-11-16 11:21:01 +01:00
Rasmus Wriedt Larsen
ae6c95ff95
Python: Fix asyncio.coroutine deprecation
...
Was removed in 3.11, see https://docs.python.org/3.10/library/asyncio-task.html#asyncio.coroutine
I couldn't make the __awwait__ actually give the result to the agen function...
I also tried looking into
https://docs.python.org/3/library/types.html#types.coroutine , but also
failed to make that work.
Without the Future, such as doing `yield SOURCE` inside `__await__` it
complains `RuntimeError: Task got bad yield: 'source'`
2023-11-15 13:24:08 +01:00
Rasmus Wriedt Larsen
55f5b26ba6
Python: Accept new ordering of query predicates in .expected
2023-11-15 10:09:54 +01:00
Rasmus Wriedt Larsen
721bde1ce8
Python: Delete orphaned .expected files
2023-11-15 09:59:26 +01:00
Rasmus Wriedt Larsen
ffc27b5301
Python: Solve problems with missing TTupleElementContent
...
Ruby uses 10 as their number. I considered doing the same, but didn't
really care _too_ much about it 🤷
14cfb82a8c/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll (L636)
2023-11-13 10:48:51 +01:00
Rasmus Wriedt Larsen
c3fa3f26a7
Python: Fix problems with missing TAttributeContent
2023-11-13 10:46:40 +01:00
Rasmus Wriedt Larsen
943b2a2ed1
Python: Highlight problem with flow summaries and TAttributeContent
2023-11-13 10:42:13 +01:00
Rasmus Wriedt Larsen
5fc8a00487
Python: Rename test function
2023-11-10 15:58:20 +01:00