mirror of
https://github.com/github/codeql.git
synced 2026-07-30 15:05:38 +02:00
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.
The interesting ORM tests files can be found under testapp/orm_*.py. These are set up to be executed by the testapp/tests.py file.
List of interesting tests files (that might go out of date if it is forgotten 😳):
- testapp/orm_tests.py: which tests flow from source to sink
- testapp/orm_form_test.py: shows how forms can be used to save Models to the DB
- testapp/orm_security_tests.py: which highlights some interesting interactions with security queries
- testapp/orm_inheritance.py: which highlights how inheritance of ORM models works
Setup
pip install django pytest pytest-django django-polymorphic
Run server
python manage.py makemigrations && python manage.py migrate && python manage.py runserver
Run tests
pytest