-
Notifications
You must be signed in to change notification settings - Fork 399
MSC4277: Harmonizing the reporting endpoints #4277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Johennes
wants to merge
9
commits into
matrix-org:main
Choose a base branch
from
Johennes:johannes/reporting-harmonization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0f9c41e
MSC4277: Harmonizing the reporting endpoints
Johennes c12e1e9
Fix typo
Johennes 34309cb
Add missing extension
Johennes 0258d25
One more typo
Johennes 8f9de37
Another typo
Johennes eca1255
Add missing period
Johennes 67c94b7
Exclude harmonising the reason parameter
Johennes efa3f23
Remove leftover potential issue
Johennes b3ac83f
Add removal of score property
Johennes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# MSC4277: Harmonizing the reporting endpoints | ||
|
||
Matrix currently has three reporting endpoints: | ||
|
||
- [`/_matrix/client/v3/rooms/{roomId}/report/{eventId}`] ([added] in Matrix | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
0.4.0, no MSC known) | ||
- [`/_matrix/client/v3/rooms/{roomId}/report`] ([added][1] in Matrix 1.13 as per | ||
[MSC4151]) | ||
- `/_matrix/client/v3/users/{userId}/report` (to be [added][2] to Matrix as per | ||
[MSC4260]) | ||
|
||
The spec contains a number of subtle differences for these endpoints: | ||
|
||
1. The user reporting endpoint [allows] servers to respond with 200 even if the | ||
user doesn't exist to deny enumerating users. This option is not allowed in | ||
the event and room reporting endpoints. | ||
2. The user and event reporting endpoints allow servers to add a random delay | ||
when generating responses. This is a more sophisticated measure against | ||
enumeration attacks. While the spec doesn't explicit forbid this technique | ||
on the room reporting endpoint it doesn't explicitly mention or recommend it | ||
either. | ||
3. The event reporting endpoint contains a `score` property in the request body | ||
that was made optional by [MSC2414] in 2020. The other two endpoints, when | ||
introduced much later, didn't include this property. Evidently, this is | ||
because `score` hasn't proved useful on event reports. | ||
|
||
These differences seem unnecessary and at least some of them were likely | ||
introduced by accident only. The present proposal, therefore, seeks to align the | ||
three endpoints. | ||
|
||
Note that in addition to the list above, the endpoints also differ in their | ||
handling of the `reason` property in the request body. [MSC2414] made `reason` | ||
optional on the event reporting endpoint. The other two endpoints, however, went | ||
the opposite direction and made `reason` required (while allowing it to be | ||
blank) to limit spam. Resolving this inconsistency is not covered by this | ||
proposal. | ||
|
||
## Proposal | ||
|
||
On all three endpoints: | ||
|
||
1. Servers MAY respond with 200 and no content regardless of whether the | ||
reported subject exists or not to combat enumeration attacks. | ||
2. Servers MAY add a random delay or use constant time functions when | ||
processing responses to combat enumeration attacks. | ||
3. The `score` property is removed. | ||
|
||
All of these changes appear applicable regardless of the reported subject and it | ||
is not clear why the spec should differentiate the endpoints here. | ||
|
||
## Potential issues | ||
|
||
Some Clients may send `score` on event reports today. These clients are not | ||
broken by this proposal because servers that implement it will simply ignore any | ||
`score` property. | ||
|
||
## Alternatives | ||
|
||
None. | ||
|
||
## Security considerations | ||
|
||
Enumeration attacks are likely more severe for users than for rooms or events. | ||
There are still not irrelevant, however. | ||
|
||
## Unstable prefix | ||
|
||
None. | ||
|
||
## Dependencies | ||
|
||
None. | ||
|
||
[`/_matrix/client/v3/rooms/{roomId}/report/{eventId}`]: https://spec.matrix.org/v1.13/client-server-api/#post_matrixclientv3roomsroomidreporteventid | ||
[added]: https://github.com/matrix-org/matrix-spec-proposals/pull/1264 | ||
[`/_matrix/client/v3/rooms/{roomId}/report`]: https://spec.matrix.org/v1.13/client-server-api/#post_matrixclientv3roomsroomidreport | ||
[1]: https://github.com/matrix-org/matrix-spec/pull/1938 | ||
[MSC4151]: https://github.com/matrix-org/matrix-spec-proposals/pull/4151 | ||
[2]: https://github.com/matrix-org/matrix-spec/pull/2093 | ||
[MSC4260]: https://github.com/matrix-org/matrix-spec-proposals/pull/4260 | ||
[allows]: https://github.com/matrix-org/matrix-spec-proposals/pull/4260/files#diff-cbb17920e2617e7a20ab0838879675f7aa70e828f0263a3cfa5f4c53913ce5f7R34-R35 | ||
[MSC2414]: https://github.com/matrix-org/matrix-spec-proposals/pull/2414 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation requirements:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
200 regardless of event / room existence: element-hq/synapse#18263
I'm unsure if the random delay / constant time part requires an implementation. The spec already mentions this for the event reporting endpoint but Synapse doesn't appear to implement it and it's not part of element-hq/synapse#18120 either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the removal of
score
into element-hq/synapse#18263. Synapse didn't do anything else than assert the type anyway.