Skip to content

Do not allow subscribing to Base channel#40685

Merged
kaspth merged 1 commit intorails:masterfrom
composerinteralia:action-cable-base-subscription
Nov 25, 2020
Merged

Do not allow subscribing to Base channel#40685
kaspth merged 1 commit intorails:masterfrom
composerinteralia:action-cable-base-subscription

Conversation

@composerinteralia
Copy link
Member

Closes #40482

Prior to this commit it was possible to subscribe with
ActionCable::Channel::Base as the subscription class. While it doesn't
seem possible to exploit this in away way, it also doesn't seem like
something we need to allow.

This commit swaps Module#>= with Module#> to prevent
subscribing to a channel when ActionCable::Channel::Base is the
subscription class.

Closes rails#40482

Prior to this commit it was possible to subscribe with
`ActionCable::Channel::Base` as the subscription class. While it doesn't
seem possible to exploit this in away way, it also doesn't seem like
something we need to allow.

This commit swaps [Module#>=][gte] with [Module#>][gt] to prevent
subscribing to a channel when `ActionCable::Channel::Base` is the
subscription class.

[gte]: https://ruby-doc.org/core-2.5.3/Module.html#method-i-3E-3D
[gt]: https://ruby-doc.org/core-2.5.3/Module.html#method-i-3E
end
end

test "subscribe command with Base channel" do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how valuable this test is. I can remove it if folks don't think it is useful.

@kaspth kaspth merged commit dac18d2 into rails:master Nov 25, 2020
@kaspth
Copy link
Contributor

kaspth commented Nov 25, 2020

Seems fine, thanks! 😄

@composerinteralia composerinteralia deleted the action-cable-base-subscription branch November 25, 2020 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ActionCable Base Class subscription

2 participants