Rasmus Wriedt Larsen
13148b42d3
Python: Handle taint of f-strings
2020-08-24 17:23:10 +02:00
Rasmus Wriedt Larsen
be2acc00db
Python: Add test for tainted f-string
2020-08-24 17:14:51 +02:00
Taus Brock-Nannestad
f07a7bf8cf
Python: Autoformat everything using qlformat.
...
Will need subsequent PRs fixing up test failures (due to deprecated
methods moving around), but other than that everything should be
straight-forward.
2020-07-07 15:43:52 +02:00
Rasmus Wriedt Larsen
26b7a301d6
Merge branch 'master' into python-keyword-only-args
2020-07-02 12:27:02 +02:00
Rasmus Wriedt Larsen
48b2d2cc5c
Python: Make isSequence() and isMapping() tests version specific
...
Since unicode/bytes difference, output can't match between Python 2 and Python 3.
2020-06-10 16:43:56 +02:00
Rasmus Wriedt Larsen
c78ca2616c
Merge branch 'master' into python-keyword-only-args
2020-05-26 11:20:04 +02:00
Rasmus Wriedt Larsen
f602f3e1c7
Python: Use proper import for semmle.python.dataflow.TaintTracking
...
It was moved in 637677d515 , but imports were not
updated.
2020-05-25 13:45:49 +02:00
Rasmus Wriedt Larsen
c5e14f5c0d
Python: Handle defaults and annotations for keyword-only arguments
...
This commit is based on a change to the extractor
2020-04-27 17:24:10 +02:00
Rasmus Wriedt Larsen
1fcbb6e9f4
Python: Better test for Argument.getDefault(i)
...
Default values for positional arugments follow a rule, so if an argument has a
default value, later positional arguments must also have default values.
The database only stores the actual default values, and nothing about the
arguments that doesn't have default values.
This turns out to be a major problem for Argument.getKwDefault(i), since default
values for keyword-only arguments doesn't have the same rule. So if you know
there is one default value, you can't tell if it is associated with `foo` or
`bar`, as in the examples below:
```
def a(*, foo=None, bar):
pass
def b(*, foo, bar=None):
pass
```
2020-04-27 17:22:56 +02:00
Rasmus Wriedt Larsen
c508e89a00
Python: Handle keyword-only arguments properly
2020-04-27 17:22:56 +02:00
Rasmus Wriedt Larsen
4185edc087
Python: Expand parameters/functions test
...
I want to ensure we handle when only _some_ parameters have default/annotations
2020-04-27 17:22:56 +02:00
Rasmus Wriedt Larsen
0cc8d49112
Python: Add tests for full Python 3 parameters syntax
...
Currently keyword-only parameters are not handled properly :(
2020-04-27 17:22:56 +02:00
Rebecca Valentine
89752f4b55
Merge branch 'master' into python-objectapi-to-valueapi-wrongnumberargumentsincall
2020-04-22 09:52:33 -07:00
Rasmus Wriedt Larsen
32a97266cf
Python: Fix deprecation warnings in test output
2020-04-21 11:39:44 +02:00
Rebecca Valentine
01aac8273c
Python: ObjAPI to ValAPI: WrongNumArgsInCall: Update queries to use objectapi
2020-04-04 03:11:25 -07:00
Taus Brock-Nannestad
b990fac97b
Python: Fix test failures.
...
How could the tests fail because of autoformatting, you may ask?
The answer is deprecation warnings. These specify the location of the deprecated
entity, and due to autoformatting these moved around.
2020-03-30 13:55:38 +02:00
Taus Brock-Nannestad
87a9f51c78
Python: Autoformat all .ql files.
2020-03-30 11:59:10 +02:00
Rasmus Wriedt Larsen
8aadb8bd06
Python: Fix iterable-unpacking tests
2020-03-27 11:42:37 +01:00
Rebecca Valentine
f351916418
Merge branch 'master' into testmerge
2020-03-17 12:32:45 -07:00
Taus
ca26feefbf
Merge pull request #2978 from BekaValentine/python-objectapi-to-valueapi-illegalexceptionhandlertype
...
Python: ObjectAPI to ValueAPI: IllegalExceptionHandlerType
2020-03-17 17:56:34 +01:00
Rasmus Wriedt Larsen
b1d1974a0f
Merge branch 'master' into python-modernise-statements
2020-03-10 14:53:44 +01:00
Rebecca Valentine
c9c469b201
Python: Modernizes queries
2020-03-09 12:52:33 -07:00
Rebecca Valentine
6d10c47cba
Python: Moves predicates over to suffixed form
2020-03-09 11:56:57 -07:00
Rebecca Valentine
a0cf2cbb13
Python: Moves old predicates to suffixed form
2020-03-03 16:53:56 -08:00
Taus Brock-Nannestad
eecace788f
Python: Fix or disable CPs introduced by #2700 and #2875 .
2020-03-03 18:18:03 +01:00
Rasmus Wriedt Larsen
f10a86d3ac
Python: Remove --optimize: true from options files
...
Tests will be run with optimizations on by default now.
2020-02-25 15:52:00 +01:00
Rasmus Wriedt Larsen
e7fdfd3d3e
Python: Move subprocess.call so super-class detection works
...
This is a temporary fix!
Added minimal working example (MWE) as a regression, so it's easier to fix the
real problem.
only Python 3 is facing the problem -- and without --max-import-depth=1 the test
times out at 10 minutes :O
2020-02-19 14:12:22 +01:00
Taus
df3ac49c28
Merge pull request #2700 from RasmusWL/python-taint-iterable-unpacking
...
Python: Handle iterable unpacking in taint tracking
2020-02-17 11:44:25 +01:00
Taus
895f2f74ab
Merge branch 'master' into python-clean-qltest-options
2020-02-12 13:44:41 +01:00
Rasmus Wriedt Larsen
c0b7dcc019
Python: Remove ignored automatic_locations in qltest options files
2020-02-06 14:28:10 +01:00
Rasmus Wriedt Larsen
397c17c4ff
Python: Use --lang=3 in tests
...
With internal update to qltest it will not actually do something.
- also remove it from the tests that never needed it.
2020-02-06 14:20:59 +01:00
Rasmus Wriedt Larsen
cb891a1a49
Python: Clean up six tests
...
We can't understand the real `six.py` file, so we have some internal plumbing
that enables us to handle six anyway. While updating that, I had a hell of a lot
of trouble with these tests.
What we actually want, is to see that we can understand what the values imported
from six are (i.e., their points-to information). I added a few more, that I
think would be useful. If we can figure out all of these, I don't actually care
if we're doing it by understanding the real `six.py` file, or by some internal
trick.
I verified that we don't get results with the real `six.py` file by disabling
our internal tricks, and putting a copy of six.py just next to test.py.
We used to have an other file that would list all the properties we knew and
their value, but that turned out to be a fragile and annoying test, since the
results differed from which version of python you ran it with (3.5 vs 3.8) and
which machine you ran it on (my machien vs jenkins). I don't care about the
results in this file, and I can certainly not eyeball it to see if it's correct
or not.
2020-02-06 13:50:51 +01:00
Rasmus Wriedt Larsen
081d66eaa3
Python: Recognize taint for extended iterable unpacking
2020-01-27 15:28:53 +01:00
Rasmus Wriedt Larsen
1b670354b2
Python: Add tests for extended iterable unpacking
2020-01-27 15:24:55 +01:00
Rasmus Wriedt Larsen
96d5703f2c
Python: Remove use of deprecated methods
2020-01-22 13:45:14 +01:00
Rasmus Wriedt Larsen
fb864b7262
Python: Consolidate tests for django
...
The tests in 3/ was not Python 3 specific anymore
2019-10-29 13:58:07 +01:00
Taus Brock-Nannestad
8882f1410a
Add test cases for nested subscripts.
2019-09-06 12:01:18 +02:00
Taus Brock-Nannestad
2d45c23d19
Comment out diverging example for now.
...
Otherwise it'll keep timing out until the fix has been pushed to LGTM.com
2019-09-05 13:18:01 +02:00
Taus Brock-Nannestad
4440e02fa5
Add test case for divergence.
2019-09-04 13:23:06 +02:00
Mark Shannon
453ae19881
Python points-to: Add .getAstNode() method to TaintedNode for forward compatibility with upcoming taint-tracking enhancements.
2019-08-16 09:54:11 +01:00
Mark Shannon
6c6e35f541
Python: Enhance points-to to support type-hint analysis.
2019-08-15 11:35:14 +01:00
Mark Shannon
54a8c64b23
Python points-to: Remove negative recursion when using legacy points-to in legacy points-to extensions.
2019-07-18 14:16:52 +01:00
Mark Shannon
30e1cbc5fc
Python: Remove Value.getSource(). It has no use.
2019-06-13 18:23:54 +01:00
Mark Shannon
0c02d3deef
Python: Fix up expected test results for six test.
2019-06-11 15:44:44 +01:00
Mark Shannon
a5ff527ac2
Python: Remove test due to instability across minor versions.
2019-05-14 10:45:43 +01:00
Mark Shannon
2905737a0e
Python points-to: Fix analysis of zero-arg super().
2019-05-13 12:00:38 +01:00
Mark Shannon
d74c76510f
Python points-to: Don't track non-descriptor class attributes on instances. Update more tests.
2019-05-13 11:46:55 +01:00
Mark Shannon
abf0347fce
Python points-to: Split strings into bytes and unicode.
2019-04-26 16:21:47 +01:00
Mark Shannon
48c0cbe51a
Python: improve handling of __all__
2019-04-26 16:21:47 +01:00
Mark Shannon
3bb61e7410
Python points-to: Improve handling of subscripts and sequence inequalities.
2019-04-26 16:21:47 +01:00