Skip to content

Commit ed3270f

Browse files
committed
Ruby: Update for upstream changes
1 parent 2e2fcd4 commit ed3270f

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

ruby/ql/lib/codeql/ruby/frameworks/ActionController.qll

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,7 @@ private class SendFile extends FileSystemAccess::Range, Http::Server::HttpRespon
559559
*/
560560
class SendDataCall extends DataFlow::CallNode, Http::Server::HttpResponse::Range {
561561
SendDataCall() {
562-
this.getMethodName() = "send_data" and
563-
(
564-
this.asExpr().getExpr() instanceof ActionControllerContextCall or
565-
this.getReceiver().asExpr().getExpr() instanceof Response::ResponseCall
566-
)
562+
this = [actionControllerInstance(), Response::response()].getAMethodCall("send_data")
567563
}
568564

569565
override DataFlow::Node getBody() { result = this.getArgument(0) }
@@ -763,8 +759,7 @@ private module Response {
763759

764760
private class ActionControllerLoggerInstance extends DataFlow::Node {
765761
ActionControllerLoggerInstance() {
766-
this.asExpr().getExpr() instanceof ActionControllerContextCall and
767-
this.(DataFlow::CallNode).getMethodName() = "logger"
762+
this = actionControllerInstance().getAMethodCall("logger")
768763
or
769764
any(ActionControllerLoggerInstance i).(DataFlow::LocalSourceNode).flowsTo(this)
770765
}

ruby/ql/test/library-tests/frameworks/action_controller/ActionController.expected

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ actionControllerControllerClasses
44
| controllers/photos_controller.rb:1:1:4:3 | PhotosController |
55
| controllers/posts_controller.rb:1:1:10:3 | PostsController |
66
| controllers/tags_controller.rb:1:1:2:3 | TagsController |
7-
| controllers/users/notifications_controller.rb:2:3:5:5 | NotificationsController |
7+
| controllers/users/notifications_controller.rb:2:3:5:5 | Users::NotificationsController |
88
| input_access.rb:1:1:50:3 | UsersController |
9-
| logging.rb:1:1:9:3 | UsersController |
10-
| params_flow.rb:1:1:151:3 | MyController |
9+
| params_flow.rb:1:1:162:3 | MyController |
10+
| params_flow.rb:170:1:178:3 | Subclass |
1111
actionControllerActionMethods
1212
| controllers/comments_controller.rb:2:3:36:5 | index |
1313
| controllers/comments_controller.rb:38:3:44:5 | show |
@@ -59,6 +59,9 @@ actionControllerActionMethods
5959
| params_flow.rb:125:3:132:5 | m30 |
6060
| params_flow.rb:134:3:141:5 | m31 |
6161
| params_flow.rb:143:3:150:5 | m32 |
62+
| params_flow.rb:152:3:159:5 | m33 |
63+
| params_flow.rb:165:3:167:5 | m34 |
64+
| params_flow.rb:171:3:173:5 | m35 |
6265
paramsCalls
6366
| controllers/foo/bars_controller.rb:13:21:13:26 | call to params |
6467
| controllers/foo/bars_controller.rb:14:10:14:15 | call to params |
@@ -106,6 +109,12 @@ paramsCalls
106109
| params_flow.rb:144:10:144:15 | call to params |
107110
| params_flow.rb:145:32:145:37 | call to params |
108111
| params_flow.rb:148:22:148:27 | call to params |
112+
| params_flow.rb:153:10:153:15 | call to params |
113+
| params_flow.rb:154:32:154:37 | call to params |
114+
| params_flow.rb:157:22:157:27 | call to params |
115+
| params_flow.rb:166:10:166:15 | call to params |
116+
| params_flow.rb:172:10:172:15 | call to params |
117+
| params_flow.rb:176:10:176:15 | call to params |
109118
paramsSources
110119
| controllers/foo/bars_controller.rb:13:21:13:26 | call to params |
111120
| controllers/foo/bars_controller.rb:14:10:14:15 | call to params |
@@ -153,6 +162,12 @@ paramsSources
153162
| params_flow.rb:144:10:144:15 | call to params |
154163
| params_flow.rb:145:32:145:37 | call to params |
155164
| params_flow.rb:148:22:148:27 | call to params |
165+
| params_flow.rb:153:10:153:15 | call to params |
166+
| params_flow.rb:154:32:154:37 | call to params |
167+
| params_flow.rb:157:22:157:27 | call to params |
168+
| params_flow.rb:166:10:166:15 | call to params |
169+
| params_flow.rb:172:10:172:15 | call to params |
170+
| params_flow.rb:176:10:176:15 | call to params |
156171
httpInputAccesses
157172
| controllers/comments_controller.rb:3:5:3:18 | call to params | ActionDispatch::Request#params |
158173
| controllers/comments_controller.rb:4:5:4:22 | call to parameters | ActionDispatch::Request#parameters |
@@ -249,6 +264,12 @@ httpInputAccesses
249264
| params_flow.rb:144:10:144:15 | call to params | ActionController::Metal#params |
250265
| params_flow.rb:145:32:145:37 | call to params | ActionController::Metal#params |
251266
| params_flow.rb:148:22:148:27 | call to params | ActionController::Metal#params |
267+
| params_flow.rb:153:10:153:15 | call to params | ActionController::Metal#params |
268+
| params_flow.rb:154:32:154:37 | call to params | ActionController::Metal#params |
269+
| params_flow.rb:157:22:157:27 | call to params | ActionController::Metal#params |
270+
| params_flow.rb:166:10:166:15 | call to params | ActionController::Metal#params |
271+
| params_flow.rb:172:10:172:15 | call to params | ActionController::Metal#params |
272+
| params_flow.rb:176:10:176:15 | call to params | ActionController::Metal#params |
252273
cookiesCalls
253274
| controllers/foo/bars_controller.rb:10:27:10:33 | call to cookies |
254275
cookiesSources

0 commit comments

Comments
 (0)