11import python
2-
3-
42import semmle.python.security.TaintTracking
53import semmle.python.security.strings.Basic
64import semmle.python.web.Http
7-
85private import semmle.python.web.pyramid.View
96private import semmle.python.web.Http
107
11- /** A pyramid response, which is vulnerable to any sort of
12- * http response malice. */
8+ /**
9+ * A pyramid response, which is vulnerable to any sort of
10+ * http response malice.
11+ */
1312class PyramidRoutedResponse extends HttpResponseTaintSink {
14-
1513 PyramidRoutedResponse ( ) {
1614 exists ( PyFunctionObject view |
1715 is_pyramid_view_function ( view .getFunction ( ) ) and
1816 this = view .getAReturnedNode ( )
1917 )
2018 }
2119
22- override predicate sinks ( TaintKind kind ) {
23- kind instanceof StringKind
24- }
25-
26- override string toString ( ) {
27- result = "pyramid.routed.response"
28- }
20+ override predicate sinks ( TaintKind kind ) { kind instanceof StringKind }
2921
22+ override string toString ( ) { result = "pyramid.routed.response" }
3023}
3124
32-
3325class PyramidCookieSet extends CookieSet , CallNode {
34-
3526 PyramidCookieSet ( ) {
3627 exists ( ControlFlowNode f |
3728 f = this .getFunction ( ) .( AttrNode ) .getObject ( "set_cookie" ) and
38- f .refersTo ( _ , ModuleObject :: named ( "pyramid" ) . attr ( " Response") , _ )
29+ f .pointsTo ( ) . getClass ( ) = Value :: named ( "pyramid.response. Response" )
3930 )
4031 }
4132
@@ -44,5 +35,4 @@ class PyramidCookieSet extends CookieSet, CallNode {
4435 override ControlFlowNode getKey ( ) { result = this .getArg ( 0 ) }
4536
4637 override ControlFlowNode getValue ( ) { result = this .getArg ( 1 ) }
47-
4838}
0 commit comments