File tree Expand file tree Collapse file tree
python/ql/test/library-tests/web/flask Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11| / | Function hello |
22| /dangerous | Function dangerous |
33| /dangerous-with-cfg-split | Function dangerous2 |
4+ | /safe | Function safe |
45| /the/ | Function get |
6+ | /unsafe | Function unsafe |
Original file line number Diff line number Diff line change 22| test.py:29 | Attribute() | externally controlled string |
33| test.py:35 | Subscript | externally controlled string |
44| test.py:36 | None | externally controlled string |
5+ | test.py:41 | BinaryExpr | externally controlled string |
6+ | test.py:41 | make_response() | externally controlled string |
7+ | test.py:46 | BinaryExpr | externally controlled string |
8+ | test.py:46 | make_response() | externally controlled string |
Original file line number Diff line number Diff line change 22| test.py:29 | Attribute | {externally controlled string} |
33| test.py:33 | Attribute | {externally controlled string} |
44| test.py:35 | Attribute | {externally controlled string} |
5+ | test.py:40 | Attribute | {externally controlled string} |
6+ | test.py:45 | Attribute | {externally controlled string} |
Original file line number Diff line number Diff line change 66| test.py:33 | Subscript | externally controlled string |
77| test.py:35 | Attribute | {externally controlled string} |
88| test.py:35 | Subscript | externally controlled string |
9+ | test.py:40 | Attribute | {externally controlled string} |
10+ | test.py:40 | Attribute() | externally controlled string |
11+ | test.py:41 | BinaryExpr | externally controlled string |
12+ | test.py:41 | first_name | externally controlled string |
13+ | test.py:41 | make_response() | flask.Response |
14+ | test.py:45 | Attribute | {externally controlled string} |
15+ | test.py:45 | Attribute() | externally controlled string |
16+ | test.py:46 | first_name | externally controlled string |
17+ | test.py:46 | make_response() | flask.Response |
Original file line number Diff line number Diff line change 11import flask
22
3- from flask import Flask , request
3+ from flask import Flask , request , make_response
44app = Flask (__name__ )
55
66@app .route ("/" )
@@ -34,3 +34,13 @@ def dangerous2():
3434 if request .method == "POST" :
3535 return request .form ['param1' ]
3636 return None
37+
38+ @app .route ('/unsafe' )
39+ def unsafe ():
40+ first_name = request .args .get ('name' , '' )
41+ return make_response ("Your name is " + first_name )
42+
43+ @app .route ('/safe' )
44+ def safe ():
45+ first_name = request .args .get ('name' , '' )
46+ return make_response ("Your name is " + escape (first_name ))
You can’t perform that action at this time.
0 commit comments