Skip to content

Commit cfde7e9

Browse files
committed
Ruby: more accurate modeling of which ActionCable channel methods become endpoints
1 parent 611ed93 commit cfde7e9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,17 @@ module ActionCable {
4343
.getConstant("Channel")
4444
.getConstant("Base")
4545
.getADescendentModule()
46-
.getAnOwnInstanceMethod() and
47-
// as long as it's public
46+
.getAnInstanceMethod() and
47+
// as long as it's not an instance method of
48+
// `ActionCable::Channel::Base` itself, which might exist in the
49+
// database
50+
not m =
51+
DataFlow::getConstant("ActionCable")
52+
.getConstant("Channel")
53+
.getConstant("Base")
54+
.asModule()
55+
.getAnInstanceMethod() and
56+
// and as long as it's public
4857
m.asCallableAstNode().isPublic() and
4958
// and is not called `subscribed` or `unsubscribed`.
5059
not m.getMethodName() = ["subscribed", "unsubscribed"]

0 commit comments

Comments
 (0)