mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
Python: Simple port of URL redirect query
Still have not added sanitizer, but seems like old sanitizer was a bit too broad (also covering %-formatting)
This commit is contained in:
@@ -1,52 +1,43 @@
|
||||
edges
|
||||
| test.py:7:14:7:25 | dict of externally controlled string | test.py:7:14:7:43 | externally controlled string |
|
||||
| test.py:7:14:7:25 | dict of externally controlled string | test.py:7:14:7:43 | externally controlled string |
|
||||
| test.py:7:14:7:43 | externally controlled string | test.py:8:21:8:26 | externally controlled string |
|
||||
| test.py:7:14:7:43 | externally controlled string | test.py:8:21:8:26 | externally controlled string |
|
||||
| test.py:30:17:30:28 | dict of externally controlled string | test.py:30:17:30:46 | externally controlled string |
|
||||
| test.py:30:17:30:28 | dict of externally controlled string | test.py:30:17:30:46 | externally controlled string |
|
||||
| test.py:30:17:30:46 | externally controlled string | test.py:31:41:31:49 | externally controlled string |
|
||||
| test.py:30:17:30:46 | externally controlled string | test.py:31:41:31:49 | externally controlled string |
|
||||
| test.py:31:12:31:50 | externally controlled string | test.py:32:21:32:24 | externally controlled string |
|
||||
| test.py:31:12:31:50 | externally controlled string | test.py:32:21:32:24 | externally controlled string |
|
||||
| test.py:31:41:31:49 | externally controlled string | test.py:31:12:31:50 | externally controlled string |
|
||||
| test.py:31:41:31:49 | externally controlled string | test.py:31:12:31:50 | externally controlled string |
|
||||
| test.py:37:17:37:28 | dict of externally controlled string | test.py:37:17:37:46 | externally controlled string |
|
||||
| test.py:37:17:37:28 | dict of externally controlled string | test.py:37:17:37:46 | externally controlled string |
|
||||
| test.py:37:17:37:46 | externally controlled string | test.py:38:32:38:40 | externally controlled string |
|
||||
| test.py:37:17:37:46 | externally controlled string | test.py:38:32:38:40 | externally controlled string |
|
||||
| test.py:38:12:38:42 | externally controlled string | test.py:39:21:39:24 | externally controlled string |
|
||||
| test.py:38:12:38:42 | externally controlled string | test.py:39:21:39:24 | externally controlled string |
|
||||
| test.py:38:32:38:40 | externally controlled string | test.py:38:12:38:42 | externally controlled string |
|
||||
| test.py:38:32:38:40 | externally controlled string | test.py:38:12:38:42 | externally controlled string |
|
||||
| test.py:53:17:53:28 | dict of externally controlled string | test.py:53:17:53:46 | externally controlled string |
|
||||
| test.py:53:17:53:28 | dict of externally controlled string | test.py:53:17:53:46 | externally controlled string |
|
||||
| test.py:53:17:53:46 | externally controlled string | test.py:54:14:54:22 | externally controlled string |
|
||||
| test.py:53:17:53:46 | externally controlled string | test.py:54:14:54:22 | externally controlled string |
|
||||
| test.py:54:14:54:22 | externally controlled string | test.py:54:14:54:41 | externally controlled string |
|
||||
| test.py:54:14:54:22 | externally controlled string | test.py:54:14:54:41 | externally controlled string |
|
||||
| test.py:54:14:54:41 | externally controlled string | test.py:55:21:55:26 | externally controlled string |
|
||||
| test.py:54:14:54:41 | externally controlled string | test.py:55:21:55:26 | externally controlled string |
|
||||
| test.py:60:17:60:28 | dict of externally controlled string | test.py:60:17:60:46 | externally controlled string |
|
||||
| test.py:60:17:60:28 | dict of externally controlled string | test.py:60:17:60:46 | externally controlled string |
|
||||
| test.py:60:17:60:46 | externally controlled string | test.py:61:40:61:48 | externally controlled string |
|
||||
| test.py:60:17:60:46 | externally controlled string | test.py:61:40:61:48 | externally controlled string |
|
||||
| test.py:61:14:61:49 | externally controlled string | test.py:62:21:62:26 | externally controlled string |
|
||||
| test.py:61:14:61:49 | externally controlled string | test.py:62:21:62:26 | externally controlled string |
|
||||
| test.py:61:40:61:48 | externally controlled string | test.py:61:14:61:49 | externally controlled string |
|
||||
| test.py:61:40:61:48 | externally controlled string | test.py:61:14:61:49 | externally controlled string |
|
||||
| test.py:67:17:67:28 | dict of externally controlled string | test.py:67:17:67:46 | externally controlled string |
|
||||
| test.py:67:17:67:28 | dict of externally controlled string | test.py:67:17:67:46 | externally controlled string |
|
||||
| test.py:67:17:67:46 | externally controlled string | test.py:68:17:68:25 | externally controlled string |
|
||||
| test.py:67:17:67:46 | externally controlled string | test.py:68:17:68:25 | externally controlled string |
|
||||
| test.py:68:14:68:41 | externally controlled string | test.py:69:21:69:26 | externally controlled string |
|
||||
| test.py:68:14:68:41 | externally controlled string | test.py:69:21:69:26 | externally controlled string |
|
||||
| test.py:68:17:68:25 | externally controlled string | test.py:68:14:68:41 | externally controlled string |
|
||||
| test.py:68:17:68:25 | externally controlled string | test.py:68:14:68:41 | externally controlled string |
|
||||
| test.py:7:14:7:25 | ControlFlowNode for Attribute | test.py:8:21:8:26 | ControlFlowNode for target |
|
||||
| test.py:15:17:15:28 | ControlFlowNode for Attribute | test.py:18:21:18:24 | ControlFlowNode for safe |
|
||||
| test.py:23:17:23:28 | ControlFlowNode for Attribute | test.py:25:21:25:24 | ControlFlowNode for safe |
|
||||
| test.py:30:17:30:28 | ControlFlowNode for Attribute | test.py:32:21:32:24 | ControlFlowNode for safe |
|
||||
| test.py:37:17:37:28 | ControlFlowNode for Attribute | test.py:39:21:39:24 | ControlFlowNode for safe |
|
||||
| test.py:44:17:44:28 | ControlFlowNode for Attribute | test.py:46:21:46:24 | ControlFlowNode for safe |
|
||||
| test.py:53:17:53:28 | ControlFlowNode for Attribute | test.py:55:21:55:26 | ControlFlowNode for unsafe |
|
||||
| test.py:60:17:60:28 | ControlFlowNode for Attribute | test.py:62:21:62:26 | ControlFlowNode for unsafe |
|
||||
| test.py:67:17:67:28 | ControlFlowNode for Attribute | test.py:69:21:69:26 | ControlFlowNode for unsafe |
|
||||
| test.py:74:17:74:28 | ControlFlowNode for Attribute | test.py:76:21:76:26 | ControlFlowNode for unsafe |
|
||||
nodes
|
||||
| test.py:7:14:7:25 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:8:21:8:26 | ControlFlowNode for target | semmle.label | ControlFlowNode for target |
|
||||
| test.py:15:17:15:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:18:21:18:24 | ControlFlowNode for safe | semmle.label | ControlFlowNode for safe |
|
||||
| test.py:23:17:23:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:25:21:25:24 | ControlFlowNode for safe | semmle.label | ControlFlowNode for safe |
|
||||
| test.py:30:17:30:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:32:21:32:24 | ControlFlowNode for safe | semmle.label | ControlFlowNode for safe |
|
||||
| test.py:37:17:37:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:39:21:39:24 | ControlFlowNode for safe | semmle.label | ControlFlowNode for safe |
|
||||
| test.py:44:17:44:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:46:21:46:24 | ControlFlowNode for safe | semmle.label | ControlFlowNode for safe |
|
||||
| test.py:53:17:53:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:55:21:55:26 | ControlFlowNode for unsafe | semmle.label | ControlFlowNode for unsafe |
|
||||
| test.py:60:17:60:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:62:21:62:26 | ControlFlowNode for unsafe | semmle.label | ControlFlowNode for unsafe |
|
||||
| test.py:67:17:67:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:69:21:69:26 | ControlFlowNode for unsafe | semmle.label | ControlFlowNode for unsafe |
|
||||
| test.py:74:17:74:28 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:76:21:76:26 | ControlFlowNode for unsafe | semmle.label | ControlFlowNode for unsafe |
|
||||
#select
|
||||
| test.py:8:21:8:26 | target | test.py:7:14:7:25 | dict of externally controlled string | test.py:8:21:8:26 | externally controlled string | Untrusted URL redirection due to $@. | test.py:7:14:7:25 | Attribute | a user-provided value |
|
||||
| test.py:32:21:32:24 | safe | test.py:30:17:30:28 | dict of externally controlled string | test.py:32:21:32:24 | externally controlled string | Untrusted URL redirection due to $@. | test.py:30:17:30:28 | Attribute | a user-provided value |
|
||||
| test.py:39:21:39:24 | safe | test.py:37:17:37:28 | dict of externally controlled string | test.py:39:21:39:24 | externally controlled string | Untrusted URL redirection due to $@. | test.py:37:17:37:28 | Attribute | a user-provided value |
|
||||
| test.py:55:21:55:26 | unsafe | test.py:53:17:53:28 | dict of externally controlled string | test.py:55:21:55:26 | externally controlled string | Untrusted URL redirection due to $@. | test.py:53:17:53:28 | Attribute | a user-provided value |
|
||||
| test.py:62:21:62:26 | unsafe | test.py:60:17:60:28 | dict of externally controlled string | test.py:62:21:62:26 | externally controlled string | Untrusted URL redirection due to $@. | test.py:60:17:60:28 | Attribute | a user-provided value |
|
||||
| test.py:69:21:69:26 | unsafe | test.py:67:17:67:28 | dict of externally controlled string | test.py:69:21:69:26 | externally controlled string | Untrusted URL redirection due to $@. | test.py:67:17:67:28 | Attribute | a user-provided value |
|
||||
| test.py:8:21:8:26 | ControlFlowNode for target | test.py:7:14:7:25 | ControlFlowNode for Attribute | test.py:8:21:8:26 | ControlFlowNode for target | Untrusted URL redirection due to $@. | test.py:7:14:7:25 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:18:21:18:24 | ControlFlowNode for safe | test.py:15:17:15:28 | ControlFlowNode for Attribute | test.py:18:21:18:24 | ControlFlowNode for safe | Untrusted URL redirection due to $@. | test.py:15:17:15:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:25:21:25:24 | ControlFlowNode for safe | test.py:23:17:23:28 | ControlFlowNode for Attribute | test.py:25:21:25:24 | ControlFlowNode for safe | Untrusted URL redirection due to $@. | test.py:23:17:23:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:32:21:32:24 | ControlFlowNode for safe | test.py:30:17:30:28 | ControlFlowNode for Attribute | test.py:32:21:32:24 | ControlFlowNode for safe | Untrusted URL redirection due to $@. | test.py:30:17:30:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:39:21:39:24 | ControlFlowNode for safe | test.py:37:17:37:28 | ControlFlowNode for Attribute | test.py:39:21:39:24 | ControlFlowNode for safe | Untrusted URL redirection due to $@. | test.py:37:17:37:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:46:21:46:24 | ControlFlowNode for safe | test.py:44:17:44:28 | ControlFlowNode for Attribute | test.py:46:21:46:24 | ControlFlowNode for safe | Untrusted URL redirection due to $@. | test.py:44:17:44:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:55:21:55:26 | ControlFlowNode for unsafe | test.py:53:17:53:28 | ControlFlowNode for Attribute | test.py:55:21:55:26 | ControlFlowNode for unsafe | Untrusted URL redirection due to $@. | test.py:53:17:53:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:62:21:62:26 | ControlFlowNode for unsafe | test.py:60:17:60:28 | ControlFlowNode for Attribute | test.py:62:21:62:26 | ControlFlowNode for unsafe | Untrusted URL redirection due to $@. | test.py:60:17:60:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:69:21:69:26 | ControlFlowNode for unsafe | test.py:67:17:67:28 | ControlFlowNode for Attribute | test.py:69:21:69:26 | ControlFlowNode for unsafe | Untrusted URL redirection due to $@. | test.py:67:17:67:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
| test.py:76:21:76:26 | ControlFlowNode for unsafe | test.py:74:17:74:28 | ControlFlowNode for Attribute | test.py:76:21:76:26 | ControlFlowNode for unsafe | Untrusted URL redirection due to $@. | test.py:74:17:74:28 | ControlFlowNode for Attribute | A user-provided value |
|
||||
|
||||
@@ -15,14 +15,14 @@ def ok():
|
||||
untrusted = request.args.get('target', '')
|
||||
safe = "https://safe.com/"
|
||||
safe += untrusted
|
||||
return redirect(safe, code=302)
|
||||
return redirect(safe, code=302) # FP
|
||||
|
||||
|
||||
@app.route('/ok2')
|
||||
def ok2():
|
||||
untrusted = request.args.get('target', '')
|
||||
safe = "https://safe.com/" + untrusted
|
||||
return redirect(safe, code=302)
|
||||
return redirect(safe, code=302) # FP
|
||||
|
||||
|
||||
@app.route('/ok3')
|
||||
@@ -43,7 +43,7 @@ def ok4():
|
||||
def ok5():
|
||||
untrusted = request.args.get('target', '')
|
||||
safe = "https://safe.com/%s" % untrusted
|
||||
return redirect(safe, code=302)
|
||||
return redirect(safe, code=302) # FP
|
||||
|
||||
|
||||
# Check that our sanitizer is not too broad
|
||||
@@ -73,4 +73,4 @@ def not_ok3():
|
||||
def not_ok4():
|
||||
untrusted = request.args.get('target', '')
|
||||
unsafe = "%s?login=success" % untrusted
|
||||
return redirect(unsafe, code=302) # Missing result
|
||||
return redirect(unsafe, code=302)
|
||||
|
||||
Reference in New Issue
Block a user