|
| 1 | +# Mass redactions |
| 2 | +Matrix, like any platform with public chat rooms, has spammers. Currently, |
| 3 | +redacting spam essentially requires spamming redaction events in a 1:1 ratio, |
| 4 | +which is not optimal<sup>[1](images/2244-redaction-spam.png)</sup>. Most |
| 5 | +clients do not even have any mass redaction tools, likely in part due to the |
| 6 | +lack of a mass redaction API. A mass redaction API on the other hand has not |
| 7 | +been implemented as it would require sending lots of events at once. However, |
| 8 | +this problem could be solved by allowing a single redaction event to redact |
| 9 | +many events instead of sending many redaction events. |
| 10 | + |
| 11 | +## Proposal |
| 12 | +This proposal builds upon [MSC2174](https://github.com/matrix-org/matrix-doc/pull/2174) |
| 13 | +and suggests making the `redacts` field in the content of `m.room.redaction` |
| 14 | +events an array of event ID strings instead of a single event ID string. |
| 15 | + |
| 16 | +It would be easiest to do this before MSC2174 is written into the spec, as then |
| 17 | +only one migration would be needed: from an event-level redacts string to a |
| 18 | +content-level redacts array. |
| 19 | + |
| 20 | +### Backwards compatibility |
| 21 | +There is no easy way to stay fully compatible with *older* clients, so the |
| 22 | +proposed solution is to not support them. In order to not break old clients |
| 23 | +completely, servers should still add a `redacts` string containing one of the |
| 24 | +redacted event IDs to the top level of `m.room.redaction` events in *newer* |
| 25 | +room versions when serving such events over the Client-Server API. |
| 26 | + |
| 27 | +Like MSC2174, for improved compatibility with *newer* clients, servers should |
| 28 | +add a `redacts` array to the `content` of `m.room.redaction` events in *older* |
| 29 | +room versions when serving such events over the Client-Server API. |
| 30 | + |
| 31 | +### Number of redactions |
| 32 | +Room v4+ event IDs are 44 bytes long, which means the federation event size |
| 33 | +limit would cap a single redaction event at a bit less than 1500 targets. |
| 34 | +Redactions are not intrinsically heavy, so a separate limit should not be |
| 35 | +necessary. |
| 36 | + |
| 37 | +Due to the possible large number of redaction targets per redaction event, |
| 38 | +servers should omit the list of redaction targets from the `unsigned` -> |
| 39 | +`redacted_because` field of redacted events. If clients want to get the list |
| 40 | +of targets of a redaction event in `redacted_because`, they should read the |
| 41 | +`event_id` field of the `redacted_because` event and use the |
| 42 | +`/rooms/{roomId}/event/{eventId}` endpoint to fetch the content. |
| 43 | + |
| 44 | +### Client behavior |
| 45 | +Clients shall apply existing `m.room.redaction` target behavior over an array |
| 46 | +of event ID strings. |
| 47 | + |
| 48 | +### Server behavior (auth rules) |
| 49 | +The target events of an `m.room.redaction` shall no longer be considered when |
| 50 | +authorizing an `m.room.redaction` event. Any other existing rules remain |
| 51 | +unchanged. |
| 52 | + |
| 53 | +After a server accepts an `m.room.redaction` using the modified auth rules, it |
| 54 | +evaluates individually whether each target can be redacted under the existing |
| 55 | +room v5 auth rules. Servers MUST NOT include failing and unknown entries to |
| 56 | +clients. |
| 57 | + |
| 58 | +> Servers do not know whether redaction targets are authorized at the time they |
| 59 | + receive the `m.room.redaction` unless they are in possession of the target |
| 60 | + event. Implementations retain entries in the original list which were not |
| 61 | + shared with clients to later evaluate the target's redaction status. |
| 62 | + |
| 63 | +When the implementation receives a belated target from an earlier |
| 64 | +`m.room.redaction`, it evaluates at that point whether the redaction is |
| 65 | +authorized. |
| 66 | + |
| 67 | +> Servers should not send belated target events to clients if their redaction |
| 68 | + was found to be in effect, as clients were not made aware of the redaction. |
| 69 | + That fact is also used to simply ignore unauthorized targets and send the |
| 70 | + events to clients normally. |
| 71 | + |
| 72 | +## Tradeoffs |
| 73 | + |
| 74 | +## Potential issues |
| 75 | + |
| 76 | +## Security considerations |
| 77 | +Server implementations should ensure that large redaction events do not become |
| 78 | +a DoS vector, e.g. by processing redactions in the background. |
0 commit comments