|
| 1 | +# MSCXXXX: Invite filtering |
| 2 | + |
| 3 | +Matrix supports ignoring users via the eponymous [module] and the `m.ignored_user_list` account data |
| 4 | +event. This is a nuclear option though and will suppress both invites and room events from the ignored |
| 5 | +users. Additionally, the `m.ignored_user_list` event only allows for block-list configurations that ignore |
| 6 | +specific users but doesn't have a mechanism to ignore entire servers. These shortcomings make the module |
| 7 | +insufficient for use cases such as tightly locked down applications where ignoring needs to be the default |
| 8 | +behaviour. |
| 9 | + |
| 10 | +This proposal generalises the ignoring users [module] to allow filtering invites specifically. The scheme |
| 11 | +outlined below is conceptually borrowed from the [gematik specification]. The main purpose of this proposal |
| 12 | +is to ensure that this option is available for comparison with [other existing MSCs] that attempt to address |
| 13 | +invite filtering. |
| 14 | + |
| 15 | + |
| 16 | +## Proposal |
| 17 | + |
| 18 | +To allow users to configure which other users are allowed to invite them into rooms, a new account data |
| 19 | +event `m.invite_permission_config` is introduced. |
| 20 | + |
| 21 | +```json5 |
| 22 | +{ |
| 23 | + "type": "m.invite_permission_config", |
| 24 | + "content": { |
| 25 | + "default": "allow | block", |
| 26 | + "user_exceptions": { |
| 27 | + "@someone:example.org": {}, |
| 28 | + ... |
| 29 | + }, |
| 30 | + "server_exceptions": { |
| 31 | + "example.org": {}, |
| 32 | + ... |
| 33 | + } |
| 34 | + } |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +The `default` field defines the standard setting that is applied to all invites that don't match an |
| 39 | +exception. Exceptions invert the default setting and are provided via the `user_exceptions` and |
| 40 | +`server_exceptions` fields which follow the format of the `ignored_users` field in `m.ignored_user_list`. |
| 41 | + |
| 42 | +As an example, a block-list configuration that ignores invites from `@badguy:scam.org` but allows invites |
| 43 | +from any other user would look like this: |
| 44 | + |
| 45 | +```json5 |
| 46 | +{ |
| 47 | + "type": "m.invite_permission_config", |
| 48 | + "content": { |
| 49 | + "default": "allow", |
| 50 | + "user_exceptions": { |
| 51 | + "@badguy:scam.org": {}, |
| 52 | + } |
| 53 | + } |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +In contrast, an allow-list configuration that permits invites from users on goodguys.org but blocks invites |
| 58 | +from all other servers would look like this: |
| 59 | + |
| 60 | +```json5 |
| 61 | +{ |
| 62 | + "type": "m.invite_permission_config", |
| 63 | + "content": { |
| 64 | + "default": "block", |
| 65 | + "server_exceptions": { |
| 66 | + "goodguys.org": {}, |
| 67 | + } |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +Note that since the default setting for entities that don't match an exception is part of the configuration, |
| 73 | +an exception for a user does _not_ need to be accompanied by an exception for their server[^1]. |
| 74 | + |
| 75 | +Servers MAY suppress invites for which the configuration evaluates to `block` and not send them to the recipient. |
| 76 | +They MAY additionally reject the invite. |
| 77 | + |
| 78 | +Clients SHOULD hide invites from users for which the permission configuration evaluates to `block`. They MAY |
| 79 | +allow reviewing ignored invites in a dedicated section of their UI. |
| 80 | + |
| 81 | + |
| 82 | +## Potential issues |
| 83 | + |
| 84 | +Larger permission configurations could run into the [event size limit] of 65536 bytes. This issue also exists |
| 85 | +with the `m.ignored_user_list` event. |
| 86 | + |
| 87 | + |
| 88 | +## Alternatives |
| 89 | + |
| 90 | +As mentioned above, the main goal of this proposal is to offer an alternative so that the question of invite |
| 91 | +filtering can be answered holistically. Therefore, this section will not attempt to make a case for why the |
| 92 | +current proposal is better than others and instead simply list the alternatives known to the author at the |
| 93 | +time of writing: |
| 94 | + |
| 95 | +- [MSC2270] (which borrows from `m.ignored_user_list` to ignore rooms and invites) |
| 96 | +- [MSC3659] (which introduces a push-rule-like grammar to filter invites) |
| 97 | +- [MSC3840] (which is similar to this proposal but only supports block-list semantics) |
| 98 | +- [MSC3847] (which ignores invites by building on [moderation policy lists] and could be combined with |
| 99 | + [MSC4150] to support both block-list and allow-list use cases) |
| 100 | + |
| 101 | + |
| 102 | +## Security considerations |
| 103 | + |
| 104 | +None. |
| 105 | + |
| 106 | + |
| 107 | +## Unstable prefix |
| 108 | + |
| 109 | +Until this proposal is accepted into the spec, implementations should refer to `m.invite_permission_config` |
| 110 | +as `org.matrix.mscXXXX.invite_permission_config`. Note that the [gematik specification], which predates |
| 111 | +this MSC, uses an event type of `de.gematik.tim.account.permissionconfig.v1` and slightly different field |
| 112 | +names. Given that the general JSON scheme of the event is the same though, implemenations of the |
| 113 | +[gematik specification] should largely be equivalent to implementations of this MSC. |
| 114 | + |
| 115 | + |
| 116 | +## Dependencies |
| 117 | + |
| 118 | +None. |
| 119 | + |
| 120 | + |
| 121 | +[^1]: This is in contrast to e.g. [Mjolnir] which requires two `org.matrix.mjolnir.allow` rules, one for |
| 122 | + the user ID and one for the server name, to build an allow list that only permits a single user. |
| 123 | + |
| 124 | +[event size limit]: https://spec.matrix.org/v1.10/client-server-api/#size-limits |
| 125 | +[gematik specification]: https://github.com/gematik/api-ti-messenger/blob/9b9f21b87949e778de85dbbc19e25f53495871e2/src/schema/permissionConfig.json |
| 126 | +[Mjolnir]: https://github.com/matrix-org/mjolnir |
| 127 | +[MSC2270]: https://github.com/matrix-org/matrix-spec-proposals/pull/2270 |
| 128 | +[MSC3659]: https://github.com/matrix-org/matrix-spec-proposals/pull/3659 |
| 129 | +[MSC3840]: https://github.com/matrix-org/matrix-spec-proposals/pull/3840 |
| 130 | +[MSC3847]: https://github.com/matrix-org/matrix-spec-proposals/pull/3847 |
| 131 | +[MSC4150]: https://github.com/matrix-org/matrix-spec-proposals/pull/4150 |
| 132 | +[moderation policy lists]: https://spec.matrix.org/v1.10/client-server-api/#moderation-policy-lists |
| 133 | +[module]: https://spec.matrix.org/v1.10/client-server-api/#ignoring-users |
| 134 | +[other existing MSCs]: #alternatives |
0 commit comments