mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Python: Model flask.jsonify
This commit is contained in:
4
python/ql/lib/change-notes/2022-09-22-flask-jsonify.md
Normal file
4
python/ql/lib/change-notes/2022-09-22-flask-jsonify.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* Added modeling of creating Flask responses with `flask.jsonify`.
|
||||
@@ -171,6 +171,24 @@ module Flask {
|
||||
override DataFlow::Node getMimetypeOrContentTypeArg() { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to `flask.jsonify` function. This creates a JSON response.
|
||||
*
|
||||
* See
|
||||
* - https://flask.palletsprojects.com/en/2.2.x/api/#flask.json.jsonify
|
||||
*/
|
||||
private class FlaskJsonifyCall extends InstanceSource, DataFlow::CallCfgNode {
|
||||
FlaskJsonifyCall() {
|
||||
this = API::moduleImport("flask").getMember("jsonify").getACall()
|
||||
}
|
||||
|
||||
override DataFlow::Node getBody() { result = this.getArg(0) }
|
||||
|
||||
override string getMimetypeDefault() { result = "application/json" }
|
||||
|
||||
override DataFlow::Node getMimetypeOrContentTypeArg() { none() }
|
||||
}
|
||||
|
||||
/** Gets a reference to an instance of `flask.Response`. */
|
||||
private DataFlow::TypeTrackingNode instance(DataFlow::TypeTracker t) {
|
||||
t.start() and
|
||||
|
||||
Reference in New Issue
Block a user