redict/tests/unit/moduleapi
Itamar Haber c1b1e8c329
Adds pub/sub channel patterns to ACL (#7993)
Fixes #7923.

This PR appropriates the special `&` symbol (because `@` and `*` are taken),
followed by a literal value or pattern for describing the Pub/Sub patterns that
an ACL user can interact with. It is similar to the existing key patterns
mechanism in function (additive) and implementation (copy-pasta). It also adds
the allchannels and resetchannels ACL keywords, naturally.

The default user is given allchannels permissions, whereas new users get
whatever is defined by the acl-pubsub-default configuration directive. For
backward compatibility in 6.2, the default of this directive is allchannels but
this is likely to be changed to resetchannels in the next major version for
stronger default security settings.

Unless allchannels is set for the user, channel access permissions are checked
as follows :
* Calls to both PUBLISH and SUBSCRIBE will fail unless a pattern matching the
  argumentative channel name(s) exists for the user.
* Calls to PSUBSCRIBE will fail unless the pattern(s) provided as an argument
  literally exist(s) in the user's list.

Such failures are logged to the ACL log.

Runtime changes to channel permissions for a user with existing subscribing
clients cause said clients to disconnect unless the new permissions permit the
connections to continue. Note, however, that PSUBSCRIBErs' patterns are matched
literally, so given the change bar:* -> b*, pattern subscribers to bar:* will be
disconnected.

Notes/questions:
* UNSUBSCRIBE, PUNSUBSCRIBE and PUBSUB remain unprotected due to lack of reasons
  for touching them.
2020-12-01 14:21:39 +02:00
..
auth.tcl Add module APIs for custom authentication 2019-12-17 06:59:59 +00:00
blockedclient.tcl Adds pub/sub channel patterns to ACL (#7993) 2020-12-01 14:21:39 +02:00
blockonkeys.tcl Try to fix time-sensitive tests in blockonkey.tcl 2020-04-03 14:51:45 +03:00
commandfilter.tcl Add runtest-moduleapi with commandfilter coverage. 2019-03-24 12:03:03 +02:00
datatype.tcl Improve RM_ModuleTypeReplaceValue() API. 2019-12-12 18:50:11 +02:00
fork.tcl fix race in module api test for fork 2020-02-23 16:48:37 +02:00
getkeys.tcl Modules: add RM_GetCommandKeys(). 2020-10-11 16:04:14 +03:00
hooks.tcl Add Swapdb Module Event (#7804) 2020-09-20 13:36:20 +03:00
infotest.tcl Add RM_ServerInfoGetFieldUnsigned 2019-11-04 08:50:29 +02:00
keyspace_events.tcl see #7544, added RedisModule_HoldString api. (#7577) 2020-08-09 06:11:47 +03:00
misc.tcl Add Module API for version and compatibility checks (#7865) 2020-10-11 17:21:58 +03:00
propagate.tcl Modules: Test MULTI/EXEC replication of RM_Replicate 2020-03-31 13:55:51 +03:00
scan.tcl Fix RM_ScanKey module api not to return int encoded strings 2020-06-14 11:20:15 +03:00
test_lazyfree.tcl Modules callbacks for lazy free effort, and unlink (#7912) 2020-11-16 10:34:04 +02:00
testrdb.tcl test infra - reduce disk space usage 2020-09-06 09:59:19 +03:00
timer.tcl Add timer module API tests. (#8041) 2020-11-11 22:57:33 +02:00