File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
lib/codeql/ruby/frameworks
test/library-tests/frameworks Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,28 @@ class ParamsSource extends RemoteFlowSource::Range {
118
118
override string getSourceType ( ) { result = "ActionController::Metal#params" }
119
119
}
120
120
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
+
121
143
// A call to `params` from within a controller.
122
144
private class ActionControllerParamsCall extends ActionControllerContextCall , ParamsCall { }
123
145
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ paramsSources
49
49
| app/controllers/foo/bars_controller.rb:21:21:21:26 | call to params |
50
50
| app/controllers/foo/bars_controller.rb:22:10:22:15 | call to params |
51
51
| 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 |
52
56
redirectToCalls
53
57
| app/controllers/foo/bars_controller.rb:17:5:17:30 | call to redirect_to |
54
58
actionControllerHelperMethods
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ query predicate paramsCalls(ParamsCall c) { any() }
10
10
11
11
query predicate paramsSources ( ParamsSource src ) { any ( ) }
12
12
13
+ query predicate cookiesCalls ( CookiesCall c ) { any ( ) }
14
+
15
+ query predicate cookiesSources ( CookiesSource src ) { any ( ) }
16
+
13
17
query predicate redirectToCalls ( RedirectToCall c ) { any ( ) }
14
18
15
19
query predicate actionControllerHelperMethods ( ActionControllerHelperMethod m ) { any ( ) }
You can’t perform that action at this time.
0 commit comments