Rasmus Wriedt Larsen
a3f1f4cb87
Python: Add iterable unpacking tests
2020-01-27 14:43:07 +01:00
Rasmus Wriedt Larsen
fa48fb04f5
Python: Recognize nested tuple/list assignment
...
Now we recognize `[(x,y)] = [(1,2)]` -- in itself not a widely used idiom, but
more of a warmup excersize for me
2020-01-27 14:42:54 +01:00
Rasmus Wriedt Larsen
9763ec71fe
Python: Add tests for nested assignment
2020-01-27 14:39:34 +01:00
Taus
5a2dfd40af
Merge pull request #2639 from RasmusWL/python-improve-dict-taint
...
Python: Improve tests for tainted collections
2020-01-24 15:06:01 +01:00
Rasmus Wriedt Larsen
5778764a48
Python: Stop using deprecated getName in collections taint test
2020-01-24 10:32:17 +01:00
Rasmus Wriedt Larsen
3db551d6bc
Python: Use variables in collection-taint test
...
They are not tainted in assignment, only in use.
I also adopted an attempt at a better test-setup, where it's easy to see if
everything is the way you hoped for, instead of browsing through 100 of lines of
taint-step output :P
2020-01-24 10:32:17 +01:00
Taus
618a35bb7c
Merge pull request #2664 from RasmusWL/python-fix-redirect-example
...
Python: Remove unused variable in example for py/url-redirection
2020-01-23 13:42:00 +01:00
Taus
d06e86f54d
Merge pull request #2662 from RasmusWL/python-taint-on-eq-test
...
Python: Only clear taint on constant comparison in if
2020-01-23 13:41:40 +01:00
Rasmus Wriedt Larsen
772538ff46
Python: Move tests of collection-taint to own dir
2020-01-22 14:24:50 +01:00
Rasmus Wriedt Larsen
df8be438bb
Python: Show that list(tainted_string) works
2020-01-22 14:24:50 +01:00
Rasmus Wriedt Larsen
0da78f216a
Python: Show that e, f, g = tainted_list doesn't work
2020-01-22 14:24:50 +01:00
Rasmus Wriedt Larsen
a55c13e61c
Python: Improve tests for StringDictKind taint
...
+ show we handle dict.values()
+ show we don't handle dict.items()
2020-01-22 14:24:50 +01:00
Rasmus Wriedt Larsen
12bb05522a
Python: Make py/weak-cryptographic-algorithm a path-problem
...
and stop using deprecated hasFlow
2020-01-22 13:45:14 +01:00
Rasmus Wriedt Larsen
c5091f1ce7
Python: Make py/hardcoded-credentials a path-problem
...
and stop using deprecated hasFlow
2020-01-22 13:45:14 +01:00
Rasmus Wriedt Larsen
96d5703f2c
Python: Remove use of deprecated methods
2020-01-22 13:45:14 +01:00
Rasmus Wriedt Larsen
422658bbdb
Python: Remove unused variable in example for py/url-redirection
2020-01-21 15:45:05 +01:00
Taus Brock-Nannestad
ead687da06
Python: Add false positive test example for issue #2652 .
2020-01-21 15:28:01 +01:00
Rasmus Wriedt Larsen
bbe93f43d3
Python: Only comparison with constant will clear taint
...
tainted = SOURCE
if tainted == tainted:
SINK(tainted) # unsafe
before, in the body of the if statement, `tainted` was not tainted
2020-01-21 15:25:57 +01:00
Rasmus Wriedt Larsen
1498145415
Python: Highlight that any comparison will clear taint
2020-01-21 15:24:56 +01:00
Taus
cfb84be7b1
Merge pull request #2540 from RasmusWL/python-modernise-variables-queries
...
Python: modernise variables queries
2020-01-10 14:45:12 +01:00
Rasmus Wriedt Larsen
9b0b0c338f
Python: Cleanup overrides tests
2020-01-06 10:55:37 +01:00
Rasmus Wriedt Larsen
15bc4cd090
Python: Add override helpers to Value classes
2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
81e27aab8d
Python: Modernise py/unused-loop-variable
2019-12-20 15:05:49 +01:00
Taus
52d231c219
Merge pull request #2469 from RasmusWL/python-modernise-twisted-library
...
Python: modernise twisted library
2019-12-18 13:55:50 +01:00
Taus
eb6feeeaf8
Merge pull request #2482 from RasmusWL/python-include-zope-web-tests
...
Python: include zope web tests from internal repo
2019-12-18 13:55:23 +01:00
Rasmus Wriedt Larsen
ac55e6aba6
Python: Modernise twisted library
2019-12-18 10:42:39 +01:00
Rasmus Wriedt Larsen
4e3c183676
Python: Adapt twisted tests so they pass
2019-12-18 10:42:39 +01:00
Rasmus Wriedt Larsen
6011cb74f8
Python: Add twisted tests from internal repo
2019-12-18 10:42:39 +01:00
Rasmus Wriedt Larsen
8b5d6ae2cf
Python: Modernise zope web tests
2019-12-17 17:42:03 +01:00
Rasmus Wriedt Larsen
e257ba40c4
Python: Make zope web tests pass
2019-12-17 17:42:03 +01:00
Henning Makholm
073563a19b
Python tests: explicitly specify --lang2 for python2 tests
...
This allows them to work with the `LegacyQltLanguage.PYTHON3` extraction recipe.
2019-12-07 02:38:02 +01:00
Rasmus Wriedt Larsen
387ab52855
Python: Add zope web tests from internal repo
2019-12-02 14:38:03 +01:00
Rasmus Wriedt Larsen
44cc9dd0be
Python: Add TurboGears templating example
2019-11-27 15:07:32 +01:00
Rasmus Wriedt Larsen
3e5e14a14b
Merge pull request #2431 from tausbn/python-cyclic-import-future-annotations
...
Python: Account for non-evaluation of annotations in cyclic imports.
2019-11-27 13:31:53 +01:00
Taus Brock-Nannestad
036e0f75c8
Python: Account for non-evaluation of annotations in cyclic imports.
...
Should fix #2426 .
Essentially, we disregard expressions used inside annotations, if these
annotations occur in a file that has `from __future__ import annotations`, as
this prevents the annotations from being evaluated.
2019-11-25 15:32:52 +01:00
Rasmus Wriedt Larsen
0f91139055
Merge pull request #2419 from tausbn/python-fix-use-of-input-fp
...
Python: Fix false positive for `py/use-of-input`.
2019-11-25 12:08:39 +01:00
Rebecca Valentine
a8204385c3
Adds fix for __init_subclass__ bug. ( #2390 )
...
* Adds fix for __init_subclass__ bug.
* Adds test case.
* Move test on name.
I think it makes more sense here, alongside the other "special" method names.
2019-11-24 12:18:17 +01:00
Taus Brock-Nannestad
67647bda66
Python: Fix false positive for py/use-of-input.
...
Fixes #1969 .
The points-to analysis does not know that the assignment `input = raw_input`
cannot fail under Python 2, and so there are two possible values that `input`
could point-to after exiting the exception handler: the built-in `input`, or the
built-in `raw_input`. In the latter case we do not want to report the alert, and
so adding a check that the given function does not point-to the built-in
`raw_input` suffices.
2019-11-22 16:46:20 +01:00
Rasmus Wriedt Larsen
46b6e6d722
Merge pull request #2409 from tausbn/python-typing-forward-reference-fp
...
Python: Support forward references inside return type annotations.
2019-11-22 11:18:04 +01:00
Taus Brock-Nannestad
033524ce63
Python: Support forward references inside return type annotations.
...
Should fix #2407 .
Also allows for the string containing the forward reference to appear inside a
subexpression of the type annotation.
2019-11-21 15:37:32 +01:00
Taus Brock-Nannestad
9fda4ab480
Python: Fix false positive in py/non-iterator-in-for-loop
...
Should fix #1833 , #2137 , and #2187 .
Internally, comprehensions are (at present) elaborated into local functions and
iterators as described in [PEP-289](https://www.python.org/dev/peps/pep-0289/ ).
That is, something like:
```
g = (x**2 for x in range(10))
```
becomes something akin to
```
def __gen(exp):
for x in exp:
yield x**2
g = __gen(iter(range(10)))
```
In the context of the top-level of a class, this means `__gen` looks as if it is
a method of the class, and in particular `exp` looks like it's the `self`
argument of this method, which leads the points-to analysis to think that `exp`
is an instance of the surrounding class itself.
The fix in this case is pretty simple: we look for occurrences of `exp` (in fact
called `.0` internally -- carefully chosen to _not_ be a valid Python
identifier) and explicitly exclude this parameter from being classified as a
`self` parameter.
2019-11-21 11:49:29 +01:00
Rasmus Wriedt Larsen
b39bcde31c
Merge pull request #2375 from tausbn/python-fix-mutable-value-type-coercion-fp
...
Python: Don't report mutable parameters that are in fact immutable.
2019-11-19 13:26:23 +01:00
Rasmus Wriedt Larsen
231414ceaf
Merge pull request #2374 from tausbn/python-fix-mappingproxytype-fp
...
Python: Fix non-container FP relating to `MappingProxyType`.
2019-11-19 13:13:26 +01:00
Taus
4c700882b6
Merge pull request #2190 from RasmusWL/python-modernise-tornado-library
...
Python: modernise tornado library
2019-11-19 09:36:30 +01:00
Taus Brock-Nannestad
1385f3c018
Python: Fix non-container FP relating to MappingProxyType.
...
Fixes #2307 .
Also modernises the query to use the `Value` API.
2019-11-18 16:50:32 +01:00
Taus Brock-Nannestad
cac261858c
Python: Don't report mutable parameters that are in fact immutable.
...
Fixes #1832 .
In the taint sink, we add an additional check that the given control-flow node
can indeed point to a value that is mutable. This takes care of the guard on the
type.
If and when we get around to adding configurations for all of the taint
analyses, we may want to implement this as a barrier instead, pruning any steps
that go through a type test where the type is not mutable.
2019-11-18 16:18:44 +01:00
Taus
78109db243
Merge pull request #2181 from RasmusWL/python-modernise-pyramid-library
...
Python: modernise pyramid library
2019-11-15 15:05:44 +01:00
Taus
cb94e7db72
Merge pull request #2140 from RasmusWL/python-fix-flask
...
Python: Modernise flask + correctly handle flask.make_response
2019-11-15 14:55:27 +01:00
Max Schaefer
5b2e32b051
Add qlpack.yml files for test folders.
2019-11-12 15:03:02 +00:00
Rasmus Wriedt Larsen
54246660c6
Python: Add test-case to password_in_cookie
2019-11-12 10:36:12 +01:00