@@ -51,13 +51,9 @@ module Beego {
5151 */
5252 private class BeegoInputSource extends UntrustedFlowSource:: Range {
5353 string methodName ;
54- FunctionOutput output ;
5554
5655 BeegoInputSource ( ) {
57- exists ( DataFlow:: MethodCallNode c | this = output .getExitNode ( c ) |
58- c .getTarget ( ) .hasQualifiedName ( contextPackagePath ( ) , "BeegoInput" , methodName )
59- ) and
60- (
56+ exists ( FunctionOutput output |
6157 methodName = "Bind" and
6258 output .isParameter ( 0 )
6359 or
@@ -66,6 +62,10 @@ module Beego {
6662 "URI" , "URL" , "UserAgent"
6763 ] and
6864 output .isResult ( 0 )
65+ |
66+ exists ( DataFlow:: MethodCallNode c | this = output .getExitNode ( c ) |
67+ c .getTarget ( ) .hasQualifiedName ( contextPackagePath ( ) , "BeegoInput" , methodName )
68+ )
6969 )
7070 }
7171
@@ -81,16 +81,8 @@ module Beego {
8181 * `beego.Controller` sources of untrusted data.
8282 */
8383 private class BeegoControllerSource extends UntrustedFlowSource:: Range {
84- string methodName ;
85- FunctionOutput output ;
86-
8784 BeegoControllerSource ( ) {
88- exists ( DataFlow:: MethodCallNode c |
89- c .getTarget ( ) .hasQualifiedName ( packagePath ( ) , "Controller" , methodName )
90- |
91- this = output .getExitNode ( c )
92- ) and
93- (
85+ exists ( string methodName , FunctionOutput output |
9486 methodName = "ParseForm" and
9587 output .isParameter ( 0 )
9688 or
@@ -99,6 +91,12 @@ module Beego {
9991 or
10092 methodName = "GetFile" and
10193 output .isResult ( 1 )
94+ |
95+ exists ( DataFlow:: MethodCallNode c |
96+ c .getTarget ( ) .hasQualifiedName ( packagePath ( ) , "Controller" , methodName )
97+ |
98+ this = output .getExitNode ( c )
99+ )
102100 )
103101 }
104102 }
@@ -225,10 +223,8 @@ module Beego {
225223 }
226224
227225 private class ContextResponseBody extends Http:: ResponseBody:: Range {
228- string name ;
229-
230226 ContextResponseBody ( ) {
231- exists ( Method m | m .hasQualifiedName ( contextPackagePath ( ) , "Context" , name ) |
227+ exists ( Method m , string name | m .hasQualifiedName ( contextPackagePath ( ) , "Context" , name ) |
232228 name = "Abort" and this = m .getACall ( ) .getArgument ( 1 )
233229 or
234230 name = "WriteString" and this = m .getACall ( ) .getArgument ( 0 )
@@ -326,16 +322,17 @@ module Beego {
326322 }
327323
328324 private class RedirectMethods extends Http:: Redirect:: Range , DataFlow:: CallNode {
329- string package ;
330325 string className ;
331326
332327 RedirectMethods ( ) {
333- (
334- package = packagePath ( ) and className = "Controller"
335- or
336- package = contextPackagePath ( ) and className = "Context"
337- ) and
338- this = any ( Method m | m .hasQualifiedName ( package , className , "Redirect" ) ) .getACall ( )
328+ exists ( string package |
329+ (
330+ package = packagePath ( ) and className = "Controller"
331+ or
332+ package = contextPackagePath ( ) and className = "Context"
333+ ) and
334+ this = any ( Method m | m .hasQualifiedName ( package , className , "Redirect" ) ) .getACall ( )
335+ )
339336 }
340337
341338 override DataFlow:: Node getUrl ( ) {
0 commit comments