@@ -3,26 +3,25 @@ import python
33import semmle.python.security.TaintTracking
44import semmle.python.web.Http
55
6- private ClassObject theTornadoRequestHandlerClass ( ) {
7- result = ModuleObject :: named ( "tornado.web" ) . attr ( " RequestHandler")
6+ private ClassValue theTornadoRequestHandlerClass ( ) {
7+ result = Value :: named ( "tornado.web. RequestHandler" )
88}
99
10- ClassObject aTornadoRequestHandlerClass ( ) {
11- result .getASuperType ( ) = theTornadoRequestHandlerClass ( )
10+ ClassValue aTornadoRequestHandlerClass ( ) {
11+ result .getABaseType + ( ) = theTornadoRequestHandlerClass ( )
1212}
1313
14- /** Holds if `node` is likely to refer to an instance of a tornado
14+ /** Holds if `node` is likely to refer to an instance of a tornado
1515 * `RequestHandler` class.
1616 */
17-
1817predicate isTornadoRequestHandlerInstance ( ControlFlowNode node ) {
19- node .refersTo ( _ , aTornadoRequestHandlerClass ( ) , _ )
18+ node .pointsTo ( ) . getClass ( ) = aTornadoRequestHandlerClass ( )
2019 or
2120 /* In some cases, the points-to analysis won't capture all instances we care
22- * about. For these, we use the following syntactic check. First, that
23- * `node` appears inside a method of a subclass of
21+ * about. For these, we use the following syntactic check. First, that
22+ * `node` appears inside a method of a subclass of
2423 * `tornado.web.RequestHandler`:*/
25- node .getScope ( ) .getEnclosingScope ( ) . ( Class ) . getClassObject ( ) = aTornadoRequestHandlerClass ( ) and
24+ node .getScope ( ) .getEnclosingScope ( ) = aTornadoRequestHandlerClass ( ) . getScope ( ) and
2625 /* Secondly, that `node` refers to the `self` argument: */
2726 node .isLoad ( ) and node .( NameNode ) .isSelf ( )
2827}
0 commit comments