Skip to content
Open
Changes from 5 commits
Commits
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
59 changes: 59 additions & 0 deletions proposals/4169-send-redact-backwards-compatibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# MSC4169: Backwards-compatible redaction sending using `/send`
[MSC2174] moved the `redacts` key from the top level to inside `content`. It
also defined forwards- and backwards-compatibility for receiving by defining
that servers will copy the key to both locations when serving events to clients.
The `/redact` endpoint is also forwards-compatible because it works in all room
versions. However, `/send` was not made backwards-compatible. This means that
Comment on lines +5 to +6
Copy link
Member

Choose a reason for hiding this comment

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

I don't see MSC2174 specifically calling out either /redact or /send. Was this an issue with server implementation?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there was any issue with /redact, but servers did obviously have to make changes to the endpoint in room v11 even though the MSC didn't call it out explicitly.

clients can't switch to using `/send` unless they keep track of room versions.

Additionally, [MSC4140] currently only defines delaying events for `/send`.
While it could be extended to support `/redact` for self-destructing messages,
the MSC can also work as-is if `/send` supported redactions in all room
versions.
Copy link
Member

Choose a reason for hiding this comment

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

I feel like you're circling the use case you're trying to support without explicitly saying it.

I think this could be better expressed as "This inconsistency makes it difficult to implement features such as self-destructing messages (utilising MSC4140's delayed events functionality, which is only implemented for /send). As clients cannot reliably use /send to send redactions across all room versions while supporting older clients."

Copy link
Member Author

Choose a reason for hiding this comment

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

The original reason why I wrote this MSC in 2024 was actually abstracting event sending in a client SDK without special-casing redactions, MSC4140 just brought it up again and was harder to work around

Copy link
Member Author

Choose a reason for hiding this comment

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

Have reworded that paragraph


[MSC4140]: https://github.com/matrix-org/matrix-spec-proposals/pull/4140
[MSC2174]: https://github.com/matrix-org/matrix-spec-proposals/pull/2174

## Proposal
The proposed solution is to have the server move the `redacts` key from the
content to the top level of the event when `/send/m.room.redaction` is called
in a pre-v11 room.

## Potential issues
Servers that don't support this MSC may behave unexpectedly if a client tries
to redact using `/send` in an old room. Synapse currently throws an assertion
error (which turns into HTTP 500) when trying to redact with /send in a pre-v11
room, which shouldn't cause any issues other than the request failing. Clients
can avoid issues by confirming server support using `/versions` first.

## Alternatives
### Client-side switching
Clients could remember room versions themselves and adjust the endpoint based
on that. This works fine for thick clients which cache data locally anyway, but
does not work for things like bots which have minimal local state.

### Just use `/redact`
`/redact` works fine for all room versions. We could discourage using `/send`
for redactions and prefer `/redact` instead.

### Deprecate `/redact`
In addition to allowing `/send`, we could encourage everyone to switch over by
formally deprecating `/redact`. However, there are some other sugar APIs like
`/ban` which do nothing `/state` can't, so `/redact` is also kept fully
supported for now. A future MSC may choose to deprecate it.

## Security considerations
This allows clients to send arbitrary content in pre-v11 redaction events.
It shouldn't cause any security issues, as it's already possible in v11+ rooms
or with a modified server.

## Unstable prefix
The endpoint itself has no unstable prefix as it can already be used to send
redactions in v11+ rooms. Support for the transformation in old room versions
can be detected using the `com.beeper.msc4169` unstable feature flag in the
`/versions` response. The feature flag should continue to be advertised after
the MSC is accepted until the server advertises support for the stable spec
release that includes this MSC.

## Dependencies
None.