Skip to content

Commit d2c0250

Browse files
committed
Ruby: Model ActionDispatch::Request#body_stream
1 parent 9f35783 commit d2c0250

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ private module Request {
296296

297297
/** A method call on `request` which returns the request body. */
298298
private class BodyCall extends RequestInputAccess {
299-
BodyCall() { this.getMethodName() = ["body", "raw_post"] }
299+
BodyCall() { this.getMethodName() = ["body", "raw_post", "body_stream"] }
300300

301301
override Http::Server::RequestInputKind getKind() { result = Http::Server::bodyInputKind() }
302302
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
actionControllerControllerClasses
2-
| controllers/comments_controller.rb:1:1:49:3 | CommentsController |
2+
| controllers/comments_controller.rb:1:1:53:3 | CommentsController |
33
| controllers/foo/bars_controller.rb:3:1:46:3 | BarsController |
44
| controllers/photos_controller.rb:1:1:4:3 | PhotosController |
55
| controllers/posts_controller.rb:1:1:10:3 | PostsController |
@@ -12,6 +12,7 @@ actionControllerActionMethods
1212
| controllers/comments_controller.rb:2:3:36:5 | index |
1313
| controllers/comments_controller.rb:38:3:44:5 | show |
1414
| controllers/comments_controller.rb:46:3:48:5 | photo |
15+
| controllers/comments_controller.rb:50:3:52:5 | destroy |
1516
| controllers/foo/bars_controller.rb:5:3:7:5 | index |
1617
| controllers/foo/bars_controller.rb:9:3:18:5 | show_debug |
1718
| controllers/foo/bars_controller.rb:20:3:24:5 | show |
@@ -160,6 +161,7 @@ httpInputAccesses
160161
| controllers/comments_controller.rb:7:5:7:28 | call to query_parameters | ActionDispatch::Request#query_parameters |
161162
| controllers/comments_controller.rb:8:5:8:30 | call to request_parameters | ActionDispatch::Request#request_parameters |
162163
| controllers/comments_controller.rb:9:5:9:31 | call to filtered_parameters | ActionDispatch::Request#filtered_parameters |
164+
| controllers/comments_controller.rb:51:12:51:30 | call to body_stream | ActionDispatch::Request#body_stream |
163165
| controllers/foo/bars_controller.rb:10:27:10:33 | call to cookies | ActionController::Metal#cookies |
164166
| controllers/foo/bars_controller.rb:13:21:13:26 | call to params | ActionController::Metal#params |
165167
| controllers/foo/bars_controller.rb:14:10:14:15 | call to params | ActionController::Metal#params |

ruby/ql/test/library-tests/frameworks/action_controller/controllers/comments_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ def show
4646
def photo
4747
send_data @photo
4848
end
49+
50+
def destroy
51+
body = request.body_stream
52+
end
4953
end

0 commit comments

Comments
 (0)