Taus
c0eb611dae
Merge pull request #12244 from RasmusWL/import-refined
...
Python: Fix import of refined variable
2023-03-24 13:22:19 +01:00
Rasmus Wriedt Larsen
b2f34ef4b1
Merge branch 'main' into import-refined
2023-03-21 15:12:11 +01:00
yoff
e21e630316
Merge branch 'main' into python/add-test-to-valid
2023-03-21 14:47:17 +01:00
Rasmus Wriedt Larsen
e90559b86d
Python: Add missing options files
...
I could not for the life of me figure out why the tests were failing,
when they were working for me locally 🤦
2023-03-21 10:24:28 +01:00
Rasmus Wriedt Larsen
346086524b
Python: Accept dataflow-consistency test changes
...
To PRs must have had a conflict when merged separately
2023-03-21 10:09:01 +01:00
Rasmus Wriedt Larsen
2ee09cc5d1
Merge branch 'main' into import-refined
2023-03-20 15:42:01 +01:00
Rasmus Wriedt Larsen
93c9f59e86
Python: Extract version specific coverage/classes.py tests
...
Since we can analyze operator.py from Python3, but not in Python 2
(since it's implemented in C), we get a difference for the index tests.
note: `operator.length_hint` is only available in Python 3.4 and later,
so would always fail under Python 2.
2023-03-20 15:39:20 +01:00
Rasmus Lerchedahl Petersen
6a5db750c4
python: add test to validation (and fix it)
2023-03-20 15:07:46 +01:00
yoff
17c9ba9872
Merge pull request #12464 from yoff/python/add-test-captured-in-collection
...
python: add test for captured variables in lists
2023-03-20 15:01:58 +01:00
Tom Hvitved
a13b6ed230
Merge pull request #12536 from hvitved/dataflow/call-enclosing-callable-consistency-check
...
Data flow: Add consistency check for `DataFlowCall::getEnclosingCallable`
2023-03-16 10:19:42 +01:00
Tom Hvitved
404ead8a18
Python: Update expected test output
2023-03-16 08:40:53 +01:00
Rasmus Wriedt Larsen
293f791611
Python: Remove solved consistency work-around
...
This has not been needed for some time now, but hadn't been removed
before now.
2023-03-09 15:45:20 +01:00
Rasmus Lerchedahl Petersen
bbb43a53e5
python: add test for captured variables
...
this illustrates that the function implementing
the comprehension does not capture `mod_local`.
We could handle this case specially, by having
a different implementation for `for`, but the
wider issue would remain.
2023-03-09 11:44:58 +01:00
Rasmus Wriedt Larsen
dda29e99b2
Python: Add test of keyword argument with same name as positional-only parameter
...
This is a bit of an edge case, but allowed. Since we currently don't
provide information on positional only arguments, we can't do much to
solve it right now.
2023-03-07 13:28:48 +01:00
Rasmus Wriedt Larsen
2cc8fbaa50
Python: Accept changes due to better import resolution of operator.py
2023-03-06 14:48:48 +01:00
Rasmus Wriedt Larsen
9e2eb56032
Python: Remove support for late *args arguments
...
I found this to cause bad performance, so the implementation of this has
to be thought out more carefully.
2023-02-15 09:42:11 +01:00
Rasmus Wriedt Larsen
cef933f813
Python: Add comment explaining SINK3_F(kwargs["c"]) test
...
Co-authored-by: yoff <yoff@github.com >
2023-01-27 15:48:59 +01:00
Rasmus Wriedt Larsen
02b3a1b515
Python: At most one **kwargs ParameterNode per callable
...
Similar to the Ruby changes from
https://github.com/github/codeql/pull/11461
I feel the change to `DataFlowFunciton.getParameter` where we use
`not exists(func.getArgByName(_))` is not very great, but I was not allowed
to use `not exists(this.getParameter(any(ParameterPosition _).isKeyword(_)))`
because of negative recursion.
2023-01-27 11:14:42 +01:00
Rasmus Wriedt Larsen
63b2bd0871
Python: Fixup test_only_starargs addition
...
validTest.py did not pass, since we use `SINK3_F`.
I initially tried swapping the order
```
args = (arg1, arg2) # $ arg1 arg2 func=starargs_only
more_args = (arg4, arg3)
starargs_only(*args, *more_args)
```
But then asked myself, what is it _actually_ we're testing here? and it
seems to be the way we handle multiple *args arguments in the same call,
so I converted the test to be that instead! (and it matches what we do
in test_stararg_mixed)
2023-01-25 09:37:07 +01:00
Rasmus Wriedt Larsen
d9fbe58ad5
Python: Expand starargs_only test
2023-01-20 16:34:59 +01:00
Rasmus Wriedt Larsen
dad6221b61
Python: Accept dataflow-consistency.expected changes for now
...
As highlighted in the configuration file, there are some things to catch
up on, and we also need to apply the same fix as Ruby for **kwargs
handling.
2023-01-17 13:58:40 +01:00
Rasmus Wriedt Larsen
749e81367d
Python: Allow multiple **kwargs parameters outside our test code
2023-01-17 13:58:40 +01:00
Rasmus Wriedt Larsen
b6272b383d
Python: Allow non-unique parameter positions for normal parameters
2023-01-17 13:58:40 +01:00
Rasmus Wriedt Larsen
e3fcfd0a66
Python: Use configuration for dataflow consistency checks in dataflow/exceptions
2023-01-17 13:55:22 +01:00
Rasmus Wriedt Larsen
61151d4aa7
Merge branch 'main' into call-graph-code
2023-01-16 13:39:15 +01:00
yoff
006eaf3e2a
Merge pull request #11088 from yoff/python/inline-query-tests
...
Python: Inline query tests
2023-01-12 10:32:26 +01:00
Tony Torralba
d87c8c75d6
Python: Remove omittable exists variables
2023-01-10 13:37:35 +01:00
Rasmus Lerchedahl Petersen
03bd6cb414
python: Allow optional result=OK
...
Also add a further test case
2023-01-06 13:33:12 +01:00
Rasmus Lerchedahl Petersen
d42bb119fe
python: align annotations with Ruby
...
use `result=BAD` for expected alert
and `result=OK` on sinks where alerts are not wanted.
2023-01-05 21:41:28 +01:00
Rasmus Lerchedahl Petersen
ad6ed2f629
python: update expectations
...
extra tests
2022-12-20 13:01:27 +01:00
yoff
5f0cde5be7
Merge branch 'main' into python/support-grouped-exceptions
2022-12-19 13:38:25 +01:00
Rasmus Lerchedahl Petersen
997e3599f0
python: make tests valid and more fleshed out
2022-12-15 12:54:16 +01:00
Rasmus Lerchedahl Petersen
8e8d36f35e
python: this also works in 3.11
2022-12-15 12:54:14 +01:00
Rasmus Lerchedahl Petersen
3ace1ee69f
Python: remove obsolete coments
2022-12-15 12:54:13 +01:00
Tom Hvitved
39fea378b8
Python: Update expected test output
2022-12-13 09:53:01 +01:00
Rasmus Wriedt Larsen
a826c4f48b
Merge branch 'main' into call-graph-code
2022-12-08 11:39:30 +01:00
Tom Hvitved
8f701cf1cb
Python: Update expected test output
2022-12-05 14:33:06 +01:00
Rasmus Wriedt Larsen
ee2f7401e8
Python: Add generator-flow/dataflow-consistency.ql
2022-11-22 14:46:33 +01:00
Rasmus Wriedt Larsen
8de5cfef43
Python: Update dataflow-consistency.expected
...
After merging in main
2022-11-22 14:46:33 +01:00
Rasmus Wriedt Larsen
c0ad870949
Python: Exclude synthetic generator functions from DataFlowCallable
2022-11-22 14:46:33 +01:00
Rasmus Wriedt Larsen
d86f98d60b
Python: Accept changes for enclosing-callable test
2022-11-22 14:46:33 +01:00
Rasmus Wriedt Larsen
aa382ac042
Python: Add test for strange generator taint flow
...
I did check, and this was not a problem with the old call-graph on main!
I'm absolutely baffled!
2022-11-22 14:46:33 +01:00
Rasmus Wriedt Larsen
df4d09b3f9
Python: Don't rely on all DataFlowCall being resolved
...
I've been living dangerously with that assumption :|
2022-11-22 14:46:32 +01:00
Rasmus Wriedt Larsen
c4122275dc
Python: Bring back support for flow-summaries
...
Also needed to fix up `TestUtil/UnresolvedCalls.qll` after a bad merge
conflict resolution. Since all calls are now DataFlowCall, and not JUST
the ones that can be resolved, we need to put in the restriction that
the callable can also be resolved.
2022-11-22 14:46:32 +01:00
Rasmus Wriedt Larsen
5e5bab5a7c
Python: Don't pass synthetic class instance to __new__ on class calls
2022-11-22 14:46:31 +01:00
Rasmus Wriedt Larsen
6fefd54533
Python: Consider __new__ a classmethod
2022-11-22 14:46:31 +01:00
Rasmus Wriedt Larsen
f040ad8dac
Python: Add test of __new__ handling
2022-11-22 14:46:31 +01:00
Rasmus Wriedt Larsen
57c7dc8ea9
Python: Allow cls passing to classmethod
2022-11-22 14:46:31 +01:00
Rasmus Wriedt Larsen
0cf13e9976
Python: Expand argument highlighting test
2022-11-22 14:46:31 +01:00
Rasmus Wriedt Larsen
5fc127cb2c
Python: Make UnresolvedCalls.qll handle class calls without __init__
...
This commit used to make sense to have here in the ordering of commits,
but due to various rebases it no longer changes any test output..
it's still a good change though, so I'll keep it.
2022-11-22 14:46:31 +01:00