Rasmus Wriedt Larsen
247fd4f5f3
Python: Make encoding/decoding preserve taint automatically
...
With the way we have set things up, there is no way to opt out of this behavior.
2020-11-02 14:53:30 +01:00
Rasmus Wriedt Larsen
66f5d0d9d5
Python: Model encoding/decoding with base64 module
2020-11-02 14:44:53 +01:00
Rasmus Wriedt Larsen
eff244db71
Python: Add Encoding concept
...
I wasn't able to find a good opposite of "parsing", so left that out of the list
of intended purposes.
2020-11-02 14:19:20 +01:00
Rasmus Lerchedahl Petersen
63cbc01c32
Python: Use subclass pattern for Models
2020-10-30 22:29:38 +01:00
Rasmus Lerchedahl Petersen
80360450de
Merge branch 'main' of github.com:github/codeql into RasmusWL-python-port-reflected-xss
2020-10-30 17:56:36 +01:00
Rasmus Lerchedahl Petersen
37ad59a92a
Python: subclas of known subclasses
2020-10-30 17:37:54 +01:00
yoff
a3cc9b6982
Update python/ql/src/experimental/semmle/python/frameworks/Flask.qll
...
Co-authored-by: Taus <tausbn@github.com >
2020-10-30 17:29:35 +01:00
Rasmus Lerchedahl Petersen
e7c9bc388b
Python: support some custom subclasses
2020-10-30 14:16:48 +01:00
Rasmus Lerchedahl Petersen
e69349791a
Python: django.http.response.HttpRequest.write
2020-10-30 12:51:23 +01:00
Rasmus Lerchedahl Petersen
fa3a7e6686
Python: Known subclasses of HttpResponse
2020-10-30 11:53:24 +01:00
Rasmus Lerchedahl Petersen
08af839757
Python: django.http.response.HttpResponseRedirect
2020-10-30 01:29:49 +01:00
Rasmus Lerchedahl Petersen
52be896666
Python: django.http.response.JsonResponse
...
It s possible this class is not relevant to XSS
2020-10-30 01:05:36 +01:00
Rasmus Lerchedahl Petersen
2ca86f5ea7
Python: django.http.response.HttpResponse
2020-10-30 00:22:53 +01:00
Rasmus Lerchedahl Petersen
6658ee9dc8
Merge branch 'python-port-reflected-xss' of https://github.com/RasmusWL/codeql into RasmusWL-python-port-reflected-xss
2020-10-29 12:46:44 +01:00
Rasmus Lerchedahl Petersen
9fd1bf60fa
Merge branch 'main' of github.com:github/codeql into python-port-path-injection
2020-10-28 10:24:23 +01:00
Rasmus Lerchedahl Petersen
c4d1affaf8
Python: Suggestions from reviewer
2020-10-23 16:57:11 +02:00
yoff
15167753c6
Apply suggestions from code review
...
Co-authored-by: Taus <tausbn@github.com >
2020-10-23 16:52:13 +02:00
Rasmus Lerchedahl Petersen
d6e9b351e5
Python: Add qldocs
2020-10-23 16:39:38 +02:00
Rasmus Lerchedahl Petersen
821b0c918a
Python: Additional taintstep for normpath
...
Is it ok to have this in general?
2020-10-23 16:35:10 +02:00
CodeQL CI
6218a48e88
Merge pull request #4545 from RasmusWL/python-model-django-v1
...
Approved by tausbn
2020-10-23 15:27:42 +01:00
Rasmus Lerchedahl Petersen
9eda84debb
Python: PathCheck -> Path::SafeAccessCheck
2020-10-23 15:01:43 +02:00
Rasmus Wriedt Larsen
d60221b168
Python: Model return from flask handler as HTTP response
...
When dealing with
```
resp = make_response(...)
return resp
```
ideally we don't want to mark the return as a creation of a HTTP response. I'll
deal with this in a second commit, to show off how annoying it looks in the
tests right now :D
2020-10-23 14:31:34 +02:00
Rasmus Wriedt Larsen
44ba3469db
Python: Model response_class attribute of Flask class
2020-10-23 14:31:34 +02:00
Rasmus Wriedt Larsen
082e35c2c7
Python: Model mimetype instead of content-type for HTTP Response
...
Since that's really what we're after (at least for now)
2020-10-23 14:31:33 +02:00
Rasmus Wriedt Larsen
1f99bbf744
Python: Model flask.Response
...
I kept `Response::instance()` predicate even though we don't need it for
anything right now, I thought it could be nice to keep for the future.
2020-10-23 14:31:32 +02:00
Rasmus Wriedt Larsen
35334cf630
Python: Remove status code modeling
...
I'm not even trying to model it properly right now, and don't have a specific
use-case for it RIGHT NOW. I think we could want this in the future, but I think
it's probably better to model it when we know what we want to use it for.
2020-10-23 14:31:31 +02:00
Rasmus Wriedt Larsen
19dc04de3c
Python: Handle make_response on flask app
2020-10-23 14:31:30 +02:00
Rasmus Wriedt Larsen
8b0b87ae62
Python: Model flask.make_response
2020-10-23 14:31:29 +02:00
Rasmus Wriedt Larsen
e93c20a7a8
Python: You can supply defaults for HTTP Response properties
2020-10-23 14:31:28 +02:00
Rasmus Wriedt Larsen
87f31a96d7
Python: Add flask_attr helper
2020-10-23 14:31:28 +02:00
Rasmus Wriedt Larsen
df6fd53a7e
Python: Add HttpResponse concept
...
We might need to rework this a bit when we also start to handle redirects. I
could see a world where we simply allow http redirects to be subclasses of http
responses, and need to manually exclude them from queries (or create
HttpContentResponse to model the HttpResponses that will contain a body). Let us
see where the wind will take us.
I looked through JS and Go libraries, but I didn't feel their modeling would map
very well to Python.
2020-10-23 14:31:25 +02:00
Rasmus Wriedt Larsen
0d6165883c
Python: Fix spelling for Server::RouteSetup documentation
2020-10-23 14:31:24 +02:00
Rasmus Wriedt Larsen
b3e53f8d0a
Python: Model django.conf.urls.url (v 1.x)
2020-10-23 14:26:37 +02:00
Rasmus Wriedt Larsen
ed0fe29d7d
Python: Fix grammar
...
Co-authored-by: Taus <tausbn@github.com >
2020-10-23 13:53:16 +02:00
Rasmus Wriedt Larsen
41ec4f8166
Python: Use FlaskModel as workaround name
...
As suggested by Taus 👍
2020-10-22 19:13:26 +02:00
Rasmus Lerchedahl Petersen
391925532d
Python: PathCheck StartswithCall
...
Should this use `Value::named`?
2020-10-22 11:34:07 +02:00
Rasmus Lerchedahl Petersen
6e361c7793
Python: Make PathCheck a BarrierGuard
2020-10-22 11:32:18 +02:00
Rasmus Lerchedahl Petersen
f8dba85e0f
Python: PathNormalization os.path.normpath
2020-10-21 22:21:40 +02:00
Rasmus Lerchedahl Petersen
17273dd27e
Python: Add FileSystemAccess open
2020-10-21 22:01:49 +02:00
Rasmus Lerchedahl Petersen
da77cbb3d0
Python: concepts PathCheck and PathNormalization
...
Should they be in a module?
2020-10-21 21:37:43 +02:00
Rasmus Wriedt Larsen
278c071fe6
Python: Modernise werkzeug FileStorage modeling
2020-10-21 20:36:40 +02:00
Rasmus Wriedt Larsen
d0fdb542e5
Python: Modernise werkzeug MultiDict modeling
2020-10-21 20:30:20 +02:00
Rasmus Wriedt Larsen
b6bd70a5da
Python: Modernise flask library modeling
...
Two interesting things happened while doing this:
1. I found out that you can't use the same name to define a submodule as any
parent module. So we need give unique names to the top-level module, and the
module for modeling the `flask.Flask` class. I randomly choose a new name for
the top-level module to get things moving (and not be stuck in bikeshedding
forever).
2. With this new setup, I wanted to expose the `route` and `add_url_rule`
methods on instances of `flask.Flask`. It wasn't quite obvious how to do so. I
simply lumped them next to `classRef()` and `instance()`, without too much
care. I did consider putting them inside a `instance` module, which would allow
you to access them by `flask::Flask::instance::route()`, but I wasn't quite
sure, and just did something easy to get moving.
2020-10-21 20:30:14 +02:00
Rasmus Wriedt Larsen
62d665ecb3
Python: Fix shared QLDoc for InstanceSource
2020-10-21 19:55:40 +02:00
Rasmus Wriedt Larsen
047a326183
Python: Remove reference to old PR
...
These have been added to internal tracking issue instead
2020-10-21 19:53:25 +02:00
Rasmus Lerchedahl Petersen
2e8cbbd866
Python: Add concept FileSystemAccess
2020-10-21 17:35:21 +02:00
Rasmus Lerchedahl Petersen
060481053a
Python: Add note about incompleteness
...
I was going to do this in an issue, but it makes sense
to have it in the code. We could still add an issue as well.
2020-10-21 15:15:19 +02:00
Rasmus Lerchedahl Petersen
c57c798bfa
Python: Add TODO
2020-10-21 15:10:40 +02:00
yoff
ee5221abb4
Apply suggestions from code review
...
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com >
2020-10-21 15:08:16 +02:00
Rasmus Lerchedahl Petersen
53ff1a32c1
Merge branch 'main' of github.com:github/codeql into python-port-sql-injection
2020-10-21 14:38:02 +02:00