Skip to content

Commit

Permalink
Merge branch 'main' into redsun82/pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
redsun82 committed May 28, 2024
2 parents f7bfe43 + 4c97b0c commit afadc1f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* The `request` parameter of Flask `SessionInterface.open_session` method is now modeled as a remote flow source.
13 changes: 13 additions & 0 deletions python/ql/lib/semmle/python/frameworks/Flask.qll
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ module Flask {
/** Gets a reference to the `flask.request` object. */
API::Node request() {
result = API::moduleImport(["flask", "flask_restful"]).getMember("request")
or
result = sessionInterfaceRequestParam()
}

/** Gets a `request` parameter of an implementation of `open_session` in a subclass of `flask.sessions.SessionInterface` */
private API::Node sessionInterfaceRequestParam() {
result =
API::moduleImport("flask")
.getMember("sessions")
.getMember("SessionInterface")
.getASubclass+()
.getMember("open_session")
.getParameter(1)
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import flask

class MySessionInterface(flask.sessions.SessionInterface):
def open_session(self, app, request):
ensure_tainted(request) # $tainted

0 comments on commit afadc1f

Please sign in to comment.