mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
Python: Expand ExternalAPIs test
We never had a showcase of how keyword arguments were handled
This commit is contained in:
@@ -1 +1 @@
|
||||
| hmac.new [param 1] | 1 | 1 |
|
||||
| hmac.new [param 1] | 2 | 1 |
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
edges
|
||||
| test.py:0:0:0:0 | ModuleVariableNode for test.request | test.py:13:16:13:22 | ControlFlowNode for request |
|
||||
| test.py:0:0:0:0 | ModuleVariableNode for test.request | test.py:23:16:23:22 | ControlFlowNode for request |
|
||||
| test.py:5:26:5:32 | ControlFlowNode for ImportMember | test.py:5:26:5:32 | GSSA Variable request |
|
||||
| test.py:5:26:5:32 | GSSA Variable request | test.py:0:0:0:0 | ModuleVariableNode for test.request |
|
||||
| test.py:13:16:13:22 | ControlFlowNode for request | test.py:13:16:13:27 | ControlFlowNode for Attribute |
|
||||
| test.py:13:16:13:27 | ControlFlowNode for Attribute | test.py:15:36:15:39 | ControlFlowNode for data |
|
||||
| test.py:23:16:23:22 | ControlFlowNode for request | test.py:23:16:23:27 | ControlFlowNode for Attribute |
|
||||
| test.py:23:16:23:27 | ControlFlowNode for Attribute | test.py:25:44:25:47 | ControlFlowNode for data |
|
||||
nodes
|
||||
| test.py:0:0:0:0 | ModuleVariableNode for test.request | semmle.label | ModuleVariableNode for test.request |
|
||||
| test.py:5:26:5:32 | ControlFlowNode for ImportMember | semmle.label | ControlFlowNode for ImportMember |
|
||||
@@ -11,6 +14,10 @@ nodes
|
||||
| test.py:13:16:13:22 | ControlFlowNode for request | semmle.label | ControlFlowNode for request |
|
||||
| test.py:13:16:13:27 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:15:36:15:39 | ControlFlowNode for data | semmle.label | ControlFlowNode for data |
|
||||
| test.py:23:16:23:22 | ControlFlowNode for request | semmle.label | ControlFlowNode for request |
|
||||
| test.py:23:16:23:27 | ControlFlowNode for Attribute | semmle.label | ControlFlowNode for Attribute |
|
||||
| test.py:25:44:25:47 | ControlFlowNode for data | semmle.label | ControlFlowNode for data |
|
||||
subpaths
|
||||
#select
|
||||
| test.py:15:36:15:39 | ControlFlowNode for data | test.py:5:26:5:32 | ControlFlowNode for ImportMember | test.py:15:36:15:39 | ControlFlowNode for data | Call to hmac.new [param 1] with untrusted data from $@. | test.py:5:26:5:32 | ControlFlowNode for ImportMember | ControlFlowNode for ImportMember |
|
||||
| test.py:25:44:25:47 | ControlFlowNode for data | test.py:5:26:5:32 | ControlFlowNode for ImportMember | test.py:25:44:25:47 | ControlFlowNode for data | Call to hmac.new [param 1] with untrusted data from $@. | test.py:5:26:5:32 | ControlFlowNode for ImportMember | ControlFlowNode for ImportMember |
|
||||
|
||||
@@ -18,11 +18,22 @@ def hmac_example():
|
||||
return "ok"
|
||||
|
||||
|
||||
@app.route("/hmac-example2")
|
||||
def hmac_example2():
|
||||
data_raw = request.args.get("data").encode('utf-8')
|
||||
data = base64.decodebytes(data_raw)
|
||||
my_hmac = hmac.new(key=SECRET_KEY, msg=data, digestmod=hashlib.sha256)
|
||||
digest = my_hmac.digest()
|
||||
print(digest)
|
||||
return "ok"
|
||||
|
||||
|
||||
@app.route("/unknown-lib-1")
|
||||
def unknown_lib_1():
|
||||
from unknown.lib import func
|
||||
data = request.args.get("data")
|
||||
func(data) # TODO: currently not recognized
|
||||
func(kw=data) # TODO: currently not recognized
|
||||
|
||||
|
||||
@app.route("/unknown-lib-2")
|
||||
@@ -30,6 +41,7 @@ def unknown_lib_2():
|
||||
import unknown.lib
|
||||
data = request.args.get("data")
|
||||
unknown.lib.func(data) # TODO: currently not recognized
|
||||
unknown.lib.func(kw=data) # TODO: currently not recognized
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user