Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
luke10481 committed Sep 22, 2024
1 parent b64e5b6 commit 511e1d6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test.ql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Node getClassNode() {

predicate test(Function routeFunc) {
exists(Node noAuthClassNode|
routeFunc.getADecorator() = getRouteNode().asExpr()
routeFunc.getADecorator() = getNoAuthClassNode().asExpr()
and not exists(Function authFunc |
authFunc.getADecorator().(Attribute).getName() = "login_required"
|routeFunc = authFunc
Expand All @@ -29,15 +29,23 @@ predicate test(Function routeFunc) {
}

Node getNoAuthClassNode() {
exists(Node noAuthClassNode|
exists(Node noAuthClassNode, API::Node flaskNode|
noAuthClassNode = getClassNode()
and not exists( Function globalFunc, Node globalNode|
globalFunc.getADecorator().(Attribute).getName() = "before_request"
and globalFunc.getName().toLowerCase().matches("%soa%")
and globalFunc.getADecorator().(Attribute).getObject() = globalNode.asExpr()
and noAuthClassNode.getALocalSource().flowsTo(globalNode)
)
| result = noAuthClassNode
|
flaskNode = [
Flask::FlaskApp::instance(),
Flask::Blueprint::instance()
]
and flaskNode.asSource() = noAuthClassNode
and result = [
flaskNode.getMember("route").getACall()
]
)
}

Expand Down

0 comments on commit 511e1d6

Please sign in to comment.