yoff
d8857c7ce8
Merge pull request #7246 from tausbn/python/import-star-flow
...
Python: Support flow through `import *`
2021-12-10 16:34:32 +01:00
Erik Krogh Kristensen
3c59aa319e
Merge pull request #7245 from erik-krogh/explicit-this-all-the-places
...
All langs: apply the explicit-this patch to all remaining code
2021-12-07 10:40:26 +01:00
Taus
33a9f86f54
Python: Change integer in trois.py
2021-12-07 08:54:07 +00:00
Taus
7f44cebed7
Python: Add missing hidden flow
...
The easiest way to implement this was to change the definition of
`module_export` to account for chains of `import *`. We reuse the
machinery from `ImportStar.qll` for this, naturally.
2021-12-02 17:11:56 +00:00
Taus
4138296ec6
Python: Add test for "hidden" import * flow
...
TL;DR: We were missing out on flow in the following situation:
`mod1.py`:
```python
foo = SOURCE
```
`mod2.py`:
```python
from mod1 import *
```
`test.py`:
```python
from mod2 import foo
SINK(foo)
```
This is because there's no node at which a read of `foo` takes place
within `test.py`, and so the added reads make no difference.
Unfortunately, this means the previous test was a bit too simplistic,
since it only looks for module variable reads and writes. Because of
this, we change the test to be a more traditional "all flow" style
(though restricted to `CfgNode`s).
2021-12-02 17:05:54 +00:00
Taus
6c3aabe1df
Python: Support flow through import *
...
Adds result for `ModuleVariableNode::getARead` corresponding to reads
that go through (chains of) `import *`.
This required a bit of a change to _which_ module variables we define.
Previously, we only included variables that were accessed elsewhere in
the same file, but now we must ensure to also include variables that may
be accessed through `import *`.
2021-11-26 13:49:08 +00:00
Taus
03b6ee3833
Python: Add import * test
...
This test shows off a few things:
- transitive chains of `import *`
- multiple modules exporting the same name (to test for cross-talk)
2021-11-26 13:49:08 +00:00
Erik Krogh Kristensen
6ff8d4de5c
add all remaining explicit this
2021-11-26 13:50:10 +01:00
Rasmus Wriedt Larsen
baafd9f8ba
Python: Add an other path injection FP
...
Along with the root cause, which is the `StringConstCompare`
BarrierGuard, that does only allows `in <iterable literal>` and not
`in <variable referencing iterable literal>`
2021-11-23 12:59:15 +01:00
Rasmus Lerchedahl Petersen
ac5a46f24f
Python: split test as suggested in review
2021-11-09 13:04:52 +01:00
Rasmus Lerchedahl Petersen
624b794980
Python: separate taint sources in with
2021-11-04 17:06:36 +01:00
Rasmus Lerchedahl Petersen
05aa314ac9
Python: Add tests for non-async constructs
2021-11-03 10:54:36 +01:00
Rasmus Lerchedahl Petersen
768932d7b3
Python: Add tainttracking step that was removed
...
when the correpsonding datadlow step was removed.
2021-11-02 15:01:47 +01:00
Rasmus Lerchedahl Petersen
07d5086b07
Python: support user defined taint source
2021-11-02 15:00:23 +01:00
Rasmus Wriedt Larsen
85f00fda19
Merge pull request #6776 from yoff/python/model-asyncpg
...
Python: Model `asyncpg`
2021-10-29 13:54:44 +02:00
Rasmus Lerchedahl Petersen
c92249525b
Python: update test expectations
2021-10-28 14:03:09 +02:00
Rasmus Lerchedahl Petersen
cca675a161
Python: Add test for async taint
...
(which we belive we have just broken)
2021-10-28 09:47:04 +02:00
Rasmus Lerchedahl Petersen
826f44d98e
Python: Share implementation of awaited
2021-10-27 11:41:18 +02:00
Rasmus Lerchedahl Petersen
8a81d42e6f
Python: more logic adjustment
...
Not sure why the missing result is missing. There is
and edge with label `getAwaited` from `pkg.async_func` on line 22
to `coro` on line 23.
2021-10-26 10:57:27 +02:00
Rasmus Lerchedahl Petersen
f91e43c068
Python: Add more honest test for awaited
2021-10-26 10:43:06 +02:00
Rasmus Lerchedahl Petersen
a8a181a32f
Python: adjust logic and add tests
...
Due to the way paths a re printed, the tests look surprising
2021-10-26 09:55:47 +02:00
Taus
75c4d6a8a0
Merge pull request #6650 from yoff/python-dataflow/init-time
...
Python: Import time dataflow
2021-10-12 11:31:03 +02:00
Rasmus Lerchedahl Petersen
19f6cc00c8
Python: rewrite import time test
2021-10-11 14:28:25 +02:00
yoff
5aee715931
Apply suggestions from code review
...
Co-authored-by: Taus <tausbn@github.com >
2021-10-11 13:00:21 +02:00
Rasmus Wriedt Larsen
8444388ec7
Python: Update .expected
2021-10-11 09:48:56 +02:00
Rasmus Lerchedahl Petersen
64b1aeaecd
Python: Shorten toString for module vars
2021-10-10 15:59:31 +02:00
Rasmus Lerchedahl Petersen
0aa632d149
Python: Move writing of module vars
...
into runtime jump steps.
2021-10-10 15:49:33 +02:00
Rasmus Wriedt Larsen
a50b193c40
Python: Model data-flow for x or y and x and y
2021-10-08 18:32:30 +02:00
Rasmus Wriedt Larsen
15476c2513
Python: Add data-flow tests for BoolExp
...
> 6.11. Boolean operations
> The expression x and y first evaluates x; if x is false, its value is
> returned; otherwise, y is evaluated and the resulting value is
> returned.
> The expression x or y first evaluates x; if x is true, its value is
> returned; otherwise, y is evaluated and the resulting value is
> returned.
2021-10-08 18:29:06 +02:00
Rasmus Lerchedahl Petersen
705970cedd
Python: Update tests to use correct tag
2021-10-08 16:57:36 +02:00
Rasmus Lerchedahl Petersen
8ba01abcd6
Merge branch 'python-dataflow/init-time' of github.com:yoff/codeql into python-dataflow/init-time
2021-10-08 16:53:08 +02:00
Rasmus Lerchedahl Petersen
4807f50c00
Merge branch 'main' of github.com:github/codeql into python-dataflow/init-time
2021-10-08 14:55:01 +02:00
yoff
933412eb8d
Apply suggestions from code review
...
Co-authored-by: Taus <tausbn@github.com >
2021-10-07 17:45:07 +02:00
Taus
b51ce1d2b3
Merge pull request #6640 from yoff/python-add-parameter-default-value-flow-step
...
Python: add parameter default value flow step
2021-09-13 17:05:48 +02:00
Rasmus Wriedt Larsen
db78e3a7da
Merge pull request #6274 from tausbn/python-api-graphs-import-star
...
Python: Support `import *` in API graphs
2021-09-10 13:25:41 +02:00
Rasmus Wriedt Larsen
b45743b562
Merge pull request #6312 from tausbn/python-deprecate-importnode
...
Python: Deprecate `importNode`
2021-09-10 13:12:56 +02:00
Rasmus Lerchedahl Petersen
6c5596d17e
Python: rewrite test
2021-09-09 13:45:44 +02:00
Rasmus Lerchedahl Petersen
e27b3162e5
Python: rewrite simpleLocalFlowStep
...
to take into account the split between
import time and runtime.
2021-09-09 12:43:08 +02:00
Rasmus Lerchedahl Petersen
baca9edbb1
Merge branch 'main' of github.com:github/codeql into python-add-parameter-default-value-flow-step
2021-09-08 14:48:13 +02:00
Rasmus Lerchedahl Petersen
a9c409403c
Python: more tests and comments
2021-09-08 14:44:36 +02:00
Rasmus Lerchedahl Petersen
9b198c6d0a
Python: Add some module initialization tests
2021-09-08 10:37:28 +02:00
Rasmus Lerchedahl Petersen
4a5f70e6c8
Python: Reclassify defaultValueFlowStep
...
as a `jumpStep`.
2021-09-08 10:05:31 +02:00
Taus Brock-Nannestad
1ab86892a0
Merge branch 'main' into python-deprecate-importnode
2021-09-07 14:59:12 +02:00
Taus Brock-Nannestad
79c3ccd56e
Python: Remove import-helper tests
...
As discussed, these are all present in the `ApiGraphs` directory
already (except for the dataflow consistency test, which has been
moved there instead).
2021-09-07 14:50:05 +02:00
Taus
51c0ceea38
Python: Update test_import_star.py
...
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com >
2021-09-07 14:15:48 +02:00
Taus Brock-Nannestad
5f5285955b
Merge branch 'main' into python-api-graphs-import-star
2021-09-07 14:13:56 +02:00
Anders Schack-Mulligen
f30dad7705
Dataflow: Update test expected outputs.
2021-09-07 13:02:20 +02:00
Rasmus Wriedt Larsen
6e9d9fcbbd
Python: Improve taint steps in for & iterable unpacking
...
These were written way before the ones in DataFlowPrivate, but
apparently didn't cover quite as much :|
2021-07-22 14:16:17 +02:00
Rasmus Wriedt Larsen
d3163d8a76
Python: Add iterable-unpacking in for test
2021-07-22 11:59:46 +02:00
Rasmus Wriedt Larsen
e2d3fa7093
Python: Add list-comprehension taint test
2021-07-22 11:59:46 +02:00