Skip to content

Commit 2b42bf0

Browse files
committed
Add additional taint steps
1 parent 4c60ea5 commit 2b42bf0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

vapi-customizations/advanced_security_demo/vapi_customizations/Customizations.qll

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import python
22
private import semmle.python.ApiGraphs
33
private import semmle.python.dataflow.new.RemoteFlowSources
4+
private import semmle.python.frameworks.internal.InstanceTaintStepsHelper
45

56
module Connexion {
67
API::Node request() { result = API::moduleImport("connexion").getMember("request") }
@@ -16,4 +17,52 @@ module Connexion {
1617

1718
override string getSourceType() { result = "connexion.request" }
1819
}
20+
21+
private class InstanceTaintSteps extends InstanceTaintStepsHelper {
22+
InstanceTaintSteps() { this = "connexion.Request" }
23+
24+
override DataFlow::Node getInstance() { result = request().getAUse() }
25+
26+
override string getAttributeName() {
27+
result in [
28+
// str
29+
"path", "full_path", "base_url", "url", "access_control_request_method",
30+
"content_encoding", "content_md5", "content_type", "data", "method", "mimetype", "origin",
31+
"query_string", "referrer", "remote_addr", "remote_user", "user_agent",
32+
// dict
33+
"environ", "cookies", "mimetype_params", "view_args",
34+
// json
35+
"json",
36+
// List[str]
37+
"access_route",
38+
// file-like
39+
"stream", "input_stream",
40+
// MultiDict[str, str]
41+
// https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.MultiDict
42+
"args", "values", "form",
43+
// MultiDict[str, FileStorage]
44+
// https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.FileStorage
45+
// TODO: FileStorage needs extra taint steps
46+
"files",
47+
// https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.HeaderSet
48+
"access_control_request_headers", "pragma",
49+
// https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.Accept
50+
// TODO: Kinda badly modeled for now -- has type List[Tuple[value, quality]], and some extra methods
51+
"accept_charsets", "accept_encodings", "accept_languages", "accept_mimetypes",
52+
// https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.Authorization
53+
// TODO: dict subclass with extra attributes like `username` and `password`
54+
"authorization",
55+
// https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.RequestCacheControl
56+
// TODO: has attributes like `no_cache`, and `to_header` method (actually, many of these models do)
57+
"cache_control",
58+
// https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.Headers
59+
// TODO: dict-like with wsgiref.headers.Header compatibility methods
60+
"headers"
61+
]
62+
}
63+
64+
override string getMethodName() { result in ["get_data", "get_json"] }
65+
66+
override string getAsyncMethodName() { none() }
67+
}
1968
}

0 commit comments

Comments
 (0)