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.
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
MSC2676: Message editing #2676
MSC2676: Message editing #2676
Changes from 10 commits
8b95ffc
7f42c8b
5473009
e44f566
634dc2e
f9768e7
1de6c11
adcdddc
fc2a690
80c467b
6cea76a
dac2399
b8a7745
79a362e
bb96694
dd1ca71
eba4753
78550a2
e58715c
4c77c01
1850fb5
c9e6652
1e63094
2373873
8ec4cf3
08489e8
f3d328d
b245761
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Not validating edits on the homeserver causes edits to be a super easy footgun for anyone writing a client or application-service. Someone can exploit this and edit anyone's message if you implement edits naively and expect the homeserver to validate edits like you can for redactions. We have first-hand experience of getting this wrong this in all of the Element clients 🥴
When exploitable, for native Matrix clients, it's most likely just a display problem since fixing the exploit on the client, results in the errant edit event being ignored and the original event shows up again or maybe even not a problem at all because Synapse filters them out of bundled data (not sure on exact Synapse details). But for bridges (application services) it can be a much bigger problem! Those edit events are not filtered out and get sent straight to the application service via
/transactions
. When someone naively relies on edit events to be correctly permissible against the room, those events get accidentally processed by the bridge and the information is persisted and overwritten in the 3rd party service.Validating edits with a power-level like redactions is a pretty good way forward though ⏩
matrix-org/synapse#5364 tracks the same problem space on Synapse
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 attempted to call out the dangers of trusting the edit events. For now, that's the framework we need to work within. If that's unworkable, it's going to need another round of changes to implementations and spec, so it's out of scope here.
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 see a note where "Client authors are reminded to take note of the requirements for Validity of message edit events, and to ignore any invalid edit events that may be received." But this doesn't really call out any danger. It's such a subtle note pointing you to a list of ways you can get it wrong.
It seems like we should at least plainly point out these examples out in the security considerations section to explain what can happen.
And maybe a note about a future consideration to have it under a power-level.
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.
the MSC could at least suggest that clients redacting events (as moderators or as senders) redact the edits too, if it knows about them...
From a moderation perspective it's certainly a good idea to redact the edits too.
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.
Is that what we actually do though? I'm reluctant to spec it if it's not a thing that happens.
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.
it's not what we do, but the rationale for why we should be redacting old versions is much easier to reason about than why we didn't implement the feature in the first place.
it's long-since been considered a security-ish issue aiui that clients (including bots) don't redact old versions properly. What would be future MSC territory though is making it happen magically from the server rather than requiring the client to do it.
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.
Hrm, it just feels like a can of worms that I don't particularly want to open right now. What happens if the client doesn't have all the edits? (ok, it's better, but it's still a crappy solution). What happens if there are a million edits and we unexpectedly hit a rate limit?
I'm not really sure what we gain by adding a "hey, we could do this totally untested temporary hack" to an MSC.
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.
Nheko does, but I don't think other clients do.
Link: https://github.com/Nheko-Reborn/nheko/blob/b6bbbdeae7966761ad2de7cdad92363c6926cfb5/src/timeline/TimelineModel.cpp#L1275
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.
but we're talking about abuse situations, not the "average", aren't we?
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.
there's several degrees of abuse which we can consider. Spamming edits is one form of abuse, but so is redacting a message and not the edits.
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.
Well fine, this isn't a hill I'm going to die on. Can you suggest some words?
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.
The Telegram bridge also redacts all edits when a message is deleted on Telegram. It causes a fun redacted event placeholder spam on Matrix because clients don't know they're edits anymore (#3389), especially if you delete a message sent by some fun telegram bot that edits a message every second for a few hours. But appservices aren't ratelimited so it's fine
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.
(A follow up MSC could also remove ratelimit for edit and reaction redactions)