-
Notifications
You must be signed in to change notification settings - Fork 380
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
MSC4205: Hashed moderation policy entities #4205
Open
Gnuxie
wants to merge
4
commits into
matrix-org:main
Choose a base branch
from
Gnuxie:gnuxie/sha256-policy-entity
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
4 commits
Select commit
Hold shift + click to select a range
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 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,102 @@ | ||
# MSC4205: Hashed moderation policy entities | ||
|
||
Currently, moderation policies describe the entity they are targeting | ||
by including a literal identifier in the `entity` field. | ||
|
||
This is problematic for multiple reasons[^msc4204]. | ||
|
||
[^msc4204]: While this MSC is not dependant upon | ||
[MSC4204](https://github.com/matrix-org/matrix-spec-proposals/pull/4204), | ||
[MSC4204](https://github.com/matrix-org/matrix-spec-proposals/pull/4204) | ||
provides a similar context for why hashing entities is desired. | ||
|
||
|
||
#### Propagating abuse | ||
|
||
The literal entities can propagate abuse. For example, | ||
if the user | ||
`@i.hate.example.com:example.com` is banned, then the | ||
mxid will be embedded in the policy. | ||
|
||
Additionally, users have been known to embed or masquerade URLs | ||
into their mxids. | ||
|
||
#### Identifying users before encountering them | ||
|
||
Policies can be used as an address book to identify problematic users | ||
who have not been encountered yet. | ||
|
||
For example, if `@yarrgh:example.com` is banned for `piracy`, | ||
then it is obvious that `@yarrgh:example.com` could be a pirate. | ||
Even if the reason was not provided with the policy. | ||
|
||
## Proposal | ||
|
||
We therefore propose a new optional field `hashes` to the top level of | ||
Gnuxie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
all moderation policy events. Embedded within this, we propose a | ||
simple `sha256` entity hash field. | ||
|
||
```json | ||
{ | ||
"type": "m.policy.rule.user", | ||
"content": { | ||
"hashes": { | ||
"sha256": "VPqwbUV7mMMkOVto3kPwsNXXiALMs7VCKWh3OeqqjGs=" | ||
}, | ||
"recommendation": "m.takedown", | ||
} | ||
} | ||
``` | ||
|
||
In this example, when a moderation tool encounters a new user, or a | ||
new policy, the tool will calculate the base64 encoded sha256 | ||
of their full mxid `@yarrgh:example.com` to | ||
match against policies that provide an associated hash. | ||
|
||
Currently the content schema for `m.policy.rule.user` requires the | ||
`entity` field. In order for the `entity` field to be omitted when a | ||
hash has been provided, the entity field will have to become optional. | ||
|
||
|
||
## Potential issues | ||
|
||
### Glob rules | ||
|
||
This proposal does not work with glob rules, and those will | ||
still have to be encoded in plain text in the `entity` field. | ||
|
||
## Alternatives | ||
|
||
None considered. | ||
|
||
## Security considerations | ||
|
||
### Dictionary attack | ||
|
||
It's important for policy curators to understand that this proposal | ||
does not prevent published hashes from being reversed. The mechanism | ||
that allows moderators to reveal banned users (by encountering them in | ||
their community) is effectively a dictionary attack against the | ||
policy list. This is how the proposal works by design. But this means | ||
that a third party that collects a sufficient amount of data on the | ||
Matrix ecosystem can reverse the hashes in the same way that a | ||
moderator can, in order to publish their own version of the list in | ||
clear text. | ||
|
||
It's important to note that the hashes are only there for obscuration | ||
purposes, to provide an indirect means to address entities. In order | ||
to hide abuse embedded directly within the identifiers. If attackers | ||
have to go elsewhere to view the list or go through extensive data | ||
collection to reveal all the hashes, then this is a secondary success. | ||
|
||
|
||
## Unstable prefix | ||
|
||
`org.matrix.msc4205.hashes` -> `hashes` | ||
|
||
## Dependencies | ||
|
||
- While not a dependency, the example shows the `m.takedown` | ||
recommendation, which is described in [MSC4204 `m.takedown` | ||
moderation policy | ||
recommendation](https://github.com/matrix-org/matrix-spec-proposals/pull/4204). |
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: