Skip to content
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

MSC2326: Label based filtering #2326

Open
wants to merge 22 commits into
base: old_master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions proposals/2326-label-based-filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,32 @@ some kind of hash, it makes it much more expensive to do because it would mean
maintaining one rainbow table for each encrypted room it's in, which would
probably make it not worth the trouble.

## Alternative solutions
Copy link
Member Author

@ara4n ara4n Sep 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just rereading this proposal, I think @dkasak's points on the main thread are legitimate: that hashing the labels give a very false sense of security here. Given how strong our e2ee is, folks will assume opaque labels are actually encrypted, rather than just obfuscated by a hash which can be easily rainbow-tabled.

Personally, I think it'd be fine to add a pepper to the hashed events, and require at the application level that for labels to work in encrypted rooms, the new user must be brought up to speed on the pepper (e.g. by the inviter sharing the pepper in an encrypted message, possibly to-device, after having invited them).

This is simpler than using opaque IDs for the unencrypted event headers, as there's only one pepper that needs to be shared to new users, rather than the whole set of opaque->real label mappings.


Instead of using hashes to identify labels in encrypted messages, using random
opaque strings was also considered. Bearing in mind that we need to be able to
use the label identifiers to filter the history of the room server-side (because
we're not expecting clients to know about the whole history of the room, see my
first point above), this solution had the following downsides, all originating
babolivier marked this conversation as resolved.
Show resolved Hide resolved
from the fact that nothing would prevent 1000 clients from using each a
different identifier:

* filtering would have serious performances issues in E2EE rooms, as the server
would need to return all events it knows about which label identifier is any
of the 1000 identifiers provided by the client, which is quite expensive to
do.

* it would be impossible for a filtered `/message` (or `/sync`) request to
include every event matching the desired label because we can't expect a
client to know about every identifier that has been used in the whole history
of the room, or about the fact that another client might suddenly decide to
use another identifier for the same label text, and include those identifiers
in its filtered request.

Another proposed solution would be to use peppered hashes, and to store the
pepper in the encrypted event. However, this solution would have the same
downsides as described above.

## Unstable prefix

Unstable implementations should hook up `org.matrix.labels` rather than
Expand Down