|
| 1 | +# MSC2249: Require users to have visibility on an event when submitting reports |
| 2 | + |
| 3 | +The [report API](https://matrix.org/docs/spec/client_server/r0.5.0#post-matrix-client-r0-rooms-roomid-report-eventid) |
| 4 | +currently does not require users to be joined to the room in order to report that an |
| 5 | +event is inappropriate. This allows anyone to report any event in any room without being joined to the room. |
| 6 | +There is limited use (and scope for abuse) for users to call report on rooms they are not joined to, |
| 7 | +so this proposal requires that reporting users must be joined to a room before they can report an event. |
| 8 | + |
| 9 | +Furthermore this proposal addresses the case where the user may not have visibility |
| 10 | +on an event (e.g. not being able to read history in a room). |
| 11 | + |
| 12 | +In that case, similar logic applies as described below. |
| 13 | + |
| 14 | +## Proposal |
| 15 | + |
| 16 | +The `/rooms/{roomId}/report/{eventId}` endpoint should check to see if the authenticated user |
| 17 | +is joined to the room in the current state of the room. If the user is not joined to the room, |
| 18 | +the room does not exist, or the event does not exist the server should respond with: |
| 19 | + |
| 20 | +```json |
| 21 | +{ |
| 22 | + "errcode": "M_NOT_FOUND", |
| 23 | + "error": "Unable to report event: it does not exist or you aren't able to see it." |
| 24 | +} |
| 25 | +``` |
| 26 | + |
| 27 | +where the contents of `error` can be left to the implementation. It is important to note that this response |
| 28 | +MUST be sent regardless if the room/event exists or not as this endpoint could be used as a way to brute |
| 29 | +force room/event IDs in order to find a room/event. |
| 30 | + |
| 31 | +It is not expected for homeservers to attempt to backfill an event they cannot find locally, as the user is unlikely to |
| 32 | +have seen an event that the homeserver has not yet stored. |
| 33 | + |
| 34 | +If the event is redacted, reports MAY still be allowed but are dependant on the implementation. |
| 35 | + |
| 36 | +## Tradeoffs |
| 37 | + |
| 38 | +None |
| 39 | + |
| 40 | +## Potential issues |
| 41 | + |
| 42 | +This will incur a performance penalty on the endpoint as the homeserver now needs to query state in the room, however |
| 43 | +this is considered acceptable given the potential to reduce abuse of the endpoint. |
| 44 | + |
| 45 | +## Security considerations |
| 46 | + |
| 47 | +Care should be taken not to give away information inadvertently by responding with different error codes depending |
| 48 | +on the existence of the room, as it may give away private rooms on the homeserver. This may be somewhat unavoidable |
| 49 | +due to the time delay for checking the existence of a room vs checking the state for a user, so implementations |
| 50 | +MAY decide to "fuzz" the response times of the endpoint to avoid time-based attacks. |
| 51 | +## Conclusion |
| 52 | + |
| 53 | +This proposal should hopefully reduce the abuse potential of the /report endpoint without significantly increasing |
| 54 | +the complexity or performance requirements on a homeserver. |
0 commit comments