Rasmus Wriedt Larsen
2cdbae08b6
Python: Don't make duplicate sink for Tornado handler
...
`self.write(...)` would be treated as *both* TornadoConnectionWrite and
TornadoHttpRequestHandlerWrite
2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
effa4548ab
Python: Add toString to TurboGears HttpResponseTaintSinks
...
Naming these were a bit hard, but better than generic "Taint Sink"
2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
6b87458c2e
Python: Add explicit tests for HttpSources and HttpSinks
...
Some of the tests currently fail, since they can't reproduce the old tests
results (since the sinks/sources defined in the library code are not
HttpResponseTaintSink/HttpRequestTaintSource)
2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
0a1c91fbb8
Python: Autoformat web tests QL files
2020-01-28 13:05:25 +01:00
Rasmus Wriedt Larsen
781024d679
Python: Recognize taint for iterable unpacking
2020-01-27 14:43:07 +01:00
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
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
96d5703f2c
Python: Remove use of deprecated methods
2020-01-22 13:45:14 +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
Taus
52d231c219
Merge pull request #2469 from RasmusWL/python-modernise-twisted-library
...
Python: modernise twisted library
2019-12-18 13:55:50 +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
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
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
78109db243
Merge pull request #2181 from RasmusWL/python-modernise-pyramid-library
...
Python: modernise pyramid library
2019-11-15 15:05:44 +01:00
Rasmus Wriedt Larsen
3ad43f32b6
Python: Add flask xss examples to flask tests
2019-11-12 10:36:10 +01:00
Rasmus Wriedt Larsen
edfcf39137
Python: Add flask tests from internal repo
2019-11-11 17:18:26 +01:00
Rasmus Wriedt Larsen
9151a7e433
Python: Always enable legacy taint tracking configuration
...
If the legacy configuration is only enabled if there are no other
configurations, defining a configuration in an imported library can lead to
unwanted results. For example, code that uses `any(MyTaintKind t).taints(node)`
would *stop* working, if it did not define its own configuration. (this actually
happened to us)
We performed a dist-compare to ensure there is not a performance deg ration by
doing this. Results at https://git.semmle.com/gist/rasmuswl/a1eca07f3a92f5f65ee78d733e5d260e
Tests that were affected by this:
- RockPaperScissors + Simple: new edges because no configuration was defined for
SqlInjectionTaint or CommandInjectionTaint
- CleartextLogging + CleartextStorage: new edges because no configuration was
defined before, AND duplicate deges.
- TestNode: new edges because no configuration was defined before
- PathInjection: Duplicate edges
- TarSlip: Duplicate edges
- CommandInjection: Duplicate edges
- ReflectedXss: Duplicate edges
- SqlInjection: Duplicate edges
- CodeInjection: Duplicate edges
- StackTraceExposure: Duplicate edges
- UnsafeDeserialization: Duplicate edges
- UrlRedirect: Duplicate edges
2019-11-11 11:17:21 +01:00
Rasmus Wriedt Larsen
fc851b46c3
Python: Fix Django class-based views
2019-10-29 13:58:07 +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
Rasmus Wriedt Larsen
471318369b
Python: Don't quote %s in django example
...
This is vulnerable to SQL injection because of the quotes around %s -- added
some code that highlights this in test.py
Since our examples did this in the safe query, I ended up rewriting them
completely, causing a lot of trouble for myself :D
2019-10-29 13:58:07 +01:00
Rasmus Wriedt Larsen
afe7a0536c
Python: Support positional arguments in Django routes
2019-10-29 13:58:07 +01:00
Rasmus Wriedt Larsen
5b6675aa71
Python: Select location first in tornado Classes test
...
so it conforms with the general scheme in tests
2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
2bb933fef0
Python: Modernise tornado library
2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
3e3833927b
Python: Remove unused getTornadoRequestHandlerMethod
...
It was only used in a test, and with the mock, it gives no results anyway.
2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
bc50e90f5b
Python: Use mock for tornado tests
2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
4248a8418b
Python: Move tornado tests from internal repo
2019-10-24 15:01:35 +02:00
Rasmus Wriedt Larsen
2874c54133
Python: Move pyramid tests from internal repo
...
Use minimal mock instead of full library
2019-10-23 16:28:46 +02:00
Rasmus Wriedt Larsen
bf197b9f20
Add testcase
2019-10-10 15:34:54 +02:00
Taus
fb20cab4c8
Merge pull request #2012 from RasmusWL/python-modernise-cls-self-checks
...
Python: modernise cls self argument name checks
2019-09-30 15:50:32 +02:00
Taus
04f14f1fe7
Merge pull request #2040 from RasmusWL/python-modernise-cherrypy
...
Python: Modernise cherrypy library
2019-09-30 11:53:59 +02:00
Rasmus Wriedt Larsen
ff28b3f1b4
Python: Modernise cherrypy library
2019-09-27 11:23:33 +02:00
Rasmus Wriedt Larsen
12c49031e8
Python: Modernise bottle library
2019-09-26 15:03:47 +02:00