diff options
author | Slava Koyfman <slavak@users.noreply.github.com> | 2023-04-02 16:18:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-02 16:18:28 +0300 |
commit | f38aa6bfb7a1bc7a3c5b18fadc513da1152bc7b5 (patch) | |
tree | 02902613299fe40dbfefc9c55527b5b52e34e1fd /tests | |
parent | 1f76bb17ddcb2adc484bf82f1b839c45e264524f (diff) | |
download | redis-f38aa6bfb7a1bc7a3c5b18fadc513da1152bc7b5.tar.gz |
Disconnect pub-sub subscribers when revoking `allchannels` permission (#11992)
The existing logic for killing pub-sub clients did not handle the `allchannels`
permission correctly. For example, if you:
ACL SETUSER foo allchannels
Have a client authenticate as the user `foo` and subscribe to a channel, and then:
ACL SETUSER foo resetchannels
The subscribed client would not be disconnected, though new clients under that user
would be blocked from subscribing to any channels.
This was caused by an incomplete optimization in `ACLKillPubsubClientsIfNeeded`
checking whether the new channel permissions were a strict superset of the old ones.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/acl.tcl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/acl.tcl b/tests/unit/acl.tcl index 555fb5a34..4d8c77b9f 100644 --- a/tests/unit/acl.tcl +++ b/tests/unit/acl.tcl @@ -289,6 +289,20 @@ start_server {tags {"acl external:skip"}} { $rd close } {0} + test {Subscribers are killed when revoked of allchannels permission} { + set rd [redis_deferring_client] + r ACL setuser psuser allchannels + $rd AUTH psuser pspass + $rd read + $rd CLIENT SETNAME deathrow + $rd read + $rd PSUBSCRIBE foo + $rd read + r ACL setuser psuser resetchannels + assert_no_match {*deathrow*} [r CLIENT LIST] + $rd close + } {0} + test {Subscribers are pardoned if literal permissions are retained and/or gaining allchannels} { set rd [redis_deferring_client] r ACL setuser psuser resetchannels &foo:1 &bar:* &orders |