yoff
3b9ea3a958
Apply suggestions from code review
...
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com >
2020-10-14 08:24:26 +02:00
Rasmus Lerchedahl Petersen
b7e8b48e9e
Python: Move concept tests out
...
These tests should be fleshed out at some point, but currently
they test all that we model.
2020-10-13 13:06:47 +02:00
Rasmus Wriedt Larsen
ce85ac3ce1
Python: Remove solved TODO
2020-10-13 10:15:03 +02:00
Rasmus Wriedt Larsen
46ec7fbf6e
Python: Make builtin compile function additional taint step
2020-10-07 21:17:39 +02:00
Rasmus Wriedt Larsen
c69a61bac5
Python: Model exec and eval calls as CodeExecution
2020-10-07 21:14:19 +02:00
Rasmus Wriedt Larsen
73971cff76
Python: Model exec statement (Python 2 only) as CodeExecution
2020-10-07 21:12:35 +02:00
Rasmus Wriedt Larsen
453c391bb0
Python: Add CodeExecution tests for stdlib
2020-10-07 21:12:31 +02:00
Rasmus Wriedt Larsen
c09695af7d
Python: Properly handle invoke.task decorator
2020-10-07 12:29:19 +02:00
Rasmus Wriedt Larsen
ebff1794fc
Python: Model invoke.context.Context
2020-10-07 12:16:53 +02:00
Rasmus Wriedt Larsen
4ef5202382
Python: Add simple model for invoke.run and invoke.sudo
...
and I sorted the list in Frameworks.qll, that kinda makes sense :)
2020-10-07 12:13:59 +02:00
Rasmus Wriedt Larsen
300a8cdf7d
Python: Add tests for the 'invoke' package
2020-10-07 11:55:26 +02:00
Rasmus Wriedt Larsen
6c4fd7c1ff
Python: Model Python 2 only platform.popen command execution
2020-10-06 20:25:03 +02:00
Rasmus Wriedt Larsen
12e4e07cae
Python: Model Python 2 only module popen2
2020-10-06 20:25:02 +02:00
Rasmus Wriedt Larsen
8c2f55fbd0
Python: Model Python 2 only os.popen2, popen3, popen4 functions
2020-10-06 20:25:01 +02:00
Rasmus Wriedt Larsen
6ec7ab2fd9
Python: Add test of Python 2 specific SystemCommandExecution
2020-10-06 20:25:00 +02:00
Rasmus Wriedt Larsen
b82727d0b8
Python: Consider routed parameter if URL pattern unknown
2020-10-06 11:03:25 +02:00
Rasmus Wriedt Larsen
16bad003a0
Python: Add test for routed params with unknown url pattern
2020-10-06 10:58:46 +02:00
Rasmus Wriedt Larsen
f03a8a838b
Python: Make any routed parameter a RemoteFlowSource
...
I'm not 100% sure whether this approach makes everything too magic, but I like
the fact that you can't _forget_ to make routed params remove-flow sources.
2020-10-06 03:03:14 +02:00
Rasmus Wriedt Larsen
b78c665f34
Python: Model RouteSetup for flask
2020-10-06 03:03:13 +02:00
Rasmus Wriedt Larsen
d7526c40ba
Python: Copy old flask tests to new dataflow setup
2020-10-06 03:02:30 +02:00
Taus
fce76e2799
Merge pull request #4354 from RasmusWL/python-command-execution-modeling
...
Python: Better command execution modeling
2020-10-02 16:14:34 +02:00
Rasmus Wriedt Larsen
e5b9ac8d9c
Python: Use getCommand as tag in ConceptsTest
2020-10-02 14:12:41 +02:00
Rasmus Wriedt Larsen
6cb2ca63a6
Python: tests to show modeling is very syntactical
2020-09-28 11:23:06 +02:00
Rasmus Wriedt Larsen
3af5c720cc
Python: Add test of more indirect command injection sinks
2020-09-28 11:16:52 +02:00
Rasmus Wriedt Larsen
f7f6564189
Python: Model subprocess.Popen (and helpers)
2020-09-28 11:13:04 +02:00
Rasmus Wriedt Larsen
62dc0dd263
Python: Model os.exec* os.spawn* and os.posix_spawn*
...
I also had to exclude the inline expectation tests from files outside the test
repo.
2020-09-28 11:05:33 +02:00
Rasmus Wriedt Larsen
c440fd0c09
Python: Adjust expectations for system command executions
...
I mostly did this to show my reviewers that the tests actually run and do
something ;)
2020-09-28 11:05:33 +02:00
Rasmus Wriedt Larsen
060720aae7
Python: Add tests for all SystemCommandExecution from stdlib
...
Overall idea is that `test/experimental/meta/ConceptsTest.qll` will set up
inline expectation tests for all the classes defined in `Concepts.qll`, so any
time you model a new instance of Concepts, you simply just import that
file. That makes the tests a little verbose, but allows us to share test-setup
between all the different frameworks we model.
Note that since the definitions of SystemCommandExecution subclasses are
scattered across multieple framework modeling qll files, it think it makes the
most sense to have the tests for each framework in one location.
I'm not 100% convinced about if this is the right choice or not (especially when
we want to write tests for sanitizers), but for now I'm going to try it out at
least.
2020-09-28 11:05:32 +02:00
Rasmus Wriedt Larsen
2acfd4cdb1
Python: Show we're able to handle example with __init__.py files
2020-09-25 18:28:31 +02:00
Rasmus Wriedt Larsen
85607fe2d5
Python: Adjust location for .expected output
2020-09-25 11:56:45 +02:00
Rasmus Wriedt Larsen
3d5511221e
Python: Add test for implicit __init__.py files
2020-09-25 11:48:38 +02:00
Rasmus Wriedt Larsen
120a569c6f
Python: Explain how CallGraph test.py even works
...
Also remove options file, since it did nothing at all (and blocked
experimental/library-tests/options from taking effect)
2020-09-25 11:42:59 +02:00
Rasmus Wriedt Larsen
624cdd339a
Python: Fix grammar
...
Co-authored-by: yoff <lerchedahl@gmail.com >
2020-09-23 11:18:12 +02:00
Rasmus Wriedt Larsen
71a75ce596
Python: Handle bound methods in flask modeling
2020-09-22 16:33:35 +02:00
Rasmus Wriedt Larsen
5709189c2a
Python: Expand flask test
2020-09-22 16:33:34 +02:00
Rasmus Wriedt Larsen
e614365963
Python: Adopt new approach in flask modeling
...
Removed all the dict-like stuff, not sure that is how we should do things.
2020-09-22 16:33:33 +02:00
Rasmus Wriedt Larsen
a82fa04d8a
Python: Add worked example of taint step modeling of external libs
...
This can't be seen on the example, but I went through quite a lot of iterations
before arriving at this fairly simple solution.
2020-09-22 16:28:26 +02:00
Rasmus Wriedt Larsen
00ea0cebc3
Python: More Flask modeling kinda works
...
It "kinda" works now, but it really is not a pretty solution. Adding all these
"tracked" objects is SUPER annoying... it _would_ be possible to skip them, but
that seems like it will give the wrong edges for dataflow/taintflow queries :|
A good chunk of it should be able to be removed with access-paths like C# does
for library modeling. Some of it could be solved by better type-tracking API
like API Graphs... but it seems like we generally are just lacking the
nice-to-have features like `.getAMemberCall` and the like. See
https://github.com/github/codeql/pull/4082/files#diff-9aa94c4d713ef9d8da73918ff53db774L33
2020-09-22 16:28:25 +02:00
Rasmus Wriedt Larsen
3c08590ee4
Python: Expand flask tests a bit
2020-09-22 16:28:24 +02:00
Rasmus Wriedt Larsen
7c205dd3fc
Python: First attempt at modeling Flask
2020-09-22 16:28:21 +02:00
Rasmus Wriedt Larsen
569e54e7bb
Python: Remove symlink from experimental test
2020-08-27 11:19:55 +02:00
Rasmus Wriedt Larsen
dc7d92ba2f
Python: Autoformat experimental/library-tests/CallGraph/
2020-07-13 16:20:02 +02:00
Rasmus Wriedt Larsen
83bd14b687
Python: Make experimental/library-tests/CallGraph pass for Python 2
...
The import doesn't actually work the intended way, so running
```
$ python python/ql/test/experimental/library-tests/CallGraph/test.py
```
will procude no output. but our extractor will extract the things we need, so
for a quick fix this will need to suffice.
2020-07-13 14:52:28 +02:00
Rasmus Wriedt Larsen
d00e7396c4
Python: Consistently use camelCase in annotated call-graph tests
2020-07-06 17:59:16 +02:00
Rasmus Wriedt Larsen
65c4e6c02a
Python: Disable class instantiation annotation for now
...
Adjusting test setup properly requires some deep thinking, and I don't think I'm
ready to do that right now. Added a TODO instead.
2020-07-06 17:48:15 +02:00
Rasmus Wriedt Larsen
cd8ea78420
Python: Autoformat
2020-07-06 17:34:19 +02:00
Rasmus Wriedt Larsen
9e252d5465
Python: Explain random example
2020-07-06 17:30:49 +02:00
Rasmus Wriedt Larsen
849159b279
Python: Unlimited import depth
2020-07-06 17:30:26 +02:00
Rasmus Wriedt Larsen
acfc62cad6
Python: Fix grammar
...
Co-authored-by: Taus <tausbn@gmail.com >
2020-07-06 17:21:29 +02:00
Rasmus Wriedt Larsen
155bbbdec9
Python: Add annotated call-graph tests
...
See the added README for in-depth details
2020-06-24 22:15:39 +02:00