|
| 1 | +# MSCXXXX: Harmonizing the reporting endpoints |
| 2 | + |
| 3 | +Matrix currently has three reporting endpoints: |
| 4 | + |
| 5 | +- [`/_matrix/client/v3/rooms/{roomId}/report/{eventId}`] ([added] in Matrix |
| 6 | + 0.4.0, no MSC known) |
| 7 | +- [`/_matrix/client/v3/rooms/{roomId}/report`] ([added][1] in Matrix 1.13 as per |
| 8 | + [MSC4151]) |
| 9 | +- `/_matrix/client/v3/users/{userId}/report` (to be [added][2] to Matrix as per |
| 10 | + [MSC4260]) |
| 11 | + |
| 12 | +The currently spec contains a number of subtle differences for these endpoints: |
| 13 | + |
| 14 | +1. The `reason` parameter on the event reporting endpoint was made optional by |
| 15 | + [MSC2414]. The other two reporting endpoints didn't pick up on this, |
| 16 | + however, and still require `reason` to be present while allowing it to be |
| 17 | + blank. |
| 18 | +2. The user reporting endpoint [allows] servers to respond with 200 even if the |
| 19 | + user doesn't exist to deny enumerating users. This option is not allowed in |
| 20 | + the event and room reporting endpoints. |
| 21 | +3. The user and event reporting endpoints allow servers to add a random delay |
| 22 | + when generating responses. This is a more sophisticated measure against |
| 23 | + enumeration attacks. While the spec doesn't explicit forbid this technique |
| 24 | + on the room reporting endpoint it doesn't explicityly mention or recommend |
| 25 | + it either. |
| 26 | + |
| 27 | +These differences seem unnecessary and were likely introduced by accident only. |
| 28 | +The present proposal, therefore, seeks to align the three endpoints. |
| 29 | + |
| 30 | +## Proposal |
| 31 | + |
| 32 | +On all three endpoints: |
| 33 | + |
| 34 | +1. The `reason` parameter is made optional. |
| 35 | + |
| 36 | +2. Servers MAY report with 200 and no content regardless of whether the |
| 37 | + reported subject exists or not to combat enumeration attacks. |
| 38 | + |
| 39 | +3. Servers MAY add a random delay or use constant time functions when |
| 40 | + processing responses to combat enumeration attacks. |
| 41 | + |
| 42 | +All of these changes appear applicable regardless of the reported subject and it |
| 43 | +is not clear why the spec should differentiate the endpoints here. |
| 44 | + |
| 45 | +## Potential issues |
| 46 | + |
| 47 | +The `reason` field on the room and user reporting endpoints is currently |
| 48 | +required. Making it optional, therefore, is a breaking change. Clients should |
| 49 | +either act on the servers supported version or blanketly include an empty string |
| 50 | +if the user doesn't provide a reason |
| 51 | + |
| 52 | +## Alternatives |
| 53 | + |
| 54 | +None. |
| 55 | + |
| 56 | +## Security considerations |
| 57 | + |
| 58 | +Enumeration attacks are likely more severe for users than for rooms or events. |
| 59 | +There are still not irrelevant, however. |
| 60 | + |
| 61 | +## Unstable prefix |
| 62 | + |
| 63 | +None. |
| 64 | + |
| 65 | +## Dependencies |
| 66 | + |
| 67 | +None. |
| 68 | + |
| 69 | + [`/_matrix/client/v3/rooms/{roomId}/report/{eventId}`]: https://spec.matrix.org/v1.13/client-server-api/#post_matrixclientv3roomsroomidreporteventid |
| 70 | + [added]: https://github.com/matrix-org/matrix-spec-proposals/pull/1264 |
| 71 | + [`/_matrix/client/v3/rooms/{roomId}/report`]: https://spec.matrix.org/v1.13/client-server-api/#post_matrixclientv3roomsroomidreport |
| 72 | + [1]: https://github.com/matrix-org/matrix-spec/pull/1938 |
| 73 | + [MSC4151]: https://github.com/matrix-org/matrix-spec-proposals/pull/4151 |
| 74 | + [2]: https://github.com/matrix-org/matrix-spec/pull/2093 |
| 75 | + [MSC4260]: https://github.com/matrix-org/matrix-spec-proposals/pull/4260 |
| 76 | + [MSC2414]: https://github.com/matrix-org/matrix-spec-proposals/pull/2414 |
| 77 | + [allows]: https://github.com/matrix-org/matrix-spec-proposals/pull/4260/files#diff-cbb17920e2617e7a20ab0838879675f7aa70e828f0263a3cfa5f4c53913ce5f7R34-R35 |
0 commit comments