File tree Expand file tree Collapse file tree
lib/codeql/ruby/frameworks
test/library-tests/frameworks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,28 @@ class ParamsSource extends RemoteFlowSource::Range {
118118 override string getSourceType ( ) { result = "ActionController::Metal#params" }
119119}
120120
121+ /**
122+ * A call to the `cookies` method to fetch the request parameters.
123+ */
124+ abstract class CookiesCall extends MethodCall {
125+ CookiesCall ( ) { this .getMethodName ( ) = "cookies" }
126+ }
127+
128+ /**
129+ * A `RemoteFlowSource::Range` to represent accessing the
130+ * ActionController parameters available via the `cookies` method.
131+ */
132+ class CookiesSource extends RemoteFlowSource:: Range {
133+ CookiesCall call ;
134+
135+ CookiesSource ( ) { this .asExpr ( ) .getExpr ( ) = call }
136+
137+ override string getSourceType ( ) { result = "ActionController::Metal#cookies" }
138+ }
139+
140+ // A call to `cookies` from within a controller.
141+ private class ActionControllerCookiesCall extends ActionControllerContextCall , CookiesCall { }
142+
121143// A call to `params` from within a controller.
122144private class ActionControllerParamsCall extends ActionControllerContextCall , ParamsCall { }
123145
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ paramsSources
4949| app/controllers/foo/bars_controller.rb:21:21:21:26 | call to params |
5050| app/controllers/foo/bars_controller.rb:22:10:22:15 | call to params |
5151| app/views/foo/bars/show.html.erb:5:9:5:14 | call to params |
52+ cookiesCalls
53+ | app/controllers/foo/bars_controller.rb:10:27:10:33 | call to cookies |
54+ cookiesSources
55+ | app/controllers/foo/bars_controller.rb:10:27:10:33 | call to cookies |
5256redirectToCalls
5357| app/controllers/foo/bars_controller.rb:17:5:17:30 | call to redirect_to |
5458actionControllerHelperMethods
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ query predicate paramsCalls(ParamsCall c) { any() }
1010
1111query predicate paramsSources ( ParamsSource src ) { any ( ) }
1212
13+ query predicate cookiesCalls ( CookiesCall c ) { any ( ) }
14+
15+ query predicate cookiesSources ( CookiesSource src ) { any ( ) }
16+
1317query predicate redirectToCalls ( RedirectToCall c ) { any ( ) }
1418
1519query predicate actionControllerHelperMethods ( ActionControllerHelperMethod m ) { any ( ) }
You can’t perform that action at this time.
0 commit comments