Skip to content

MSC4293: Redact on ban #4293

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
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

MSC4293: Redact on ban #4293

wants to merge 4 commits into from

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented May 27, 2025

Rendered

Disclosure: I am Director of Standards Development at The Matrix.org Foundation C.I.C., Matrix Spec Core Team (SCT) member, employed by Element, and operate the t2bot.io service. This proposal is written and published as a Trust & Safety team member allocated in full to the Foundation.


MSC checklist

FCP tickyboxes

@turt2live turt2live changed the title MSC: Redact on ban MSC4293: Redact on ban May 27, 2025
@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:core MSC which is critical to the protocol's success needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. safety labels May 27, 2025
@turt2live turt2live marked this pull request as ready for review May 27, 2025 21:51
Copy link
Contributor

@Gnuxie Gnuxie left a comment

Choose a reason for hiding this comment

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

yes please!

Copy link
Member Author

@turt2live turt2live Jun 9, 2025

Choose a reason for hiding this comment

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

@turt2live
Copy link
Member Author

MSCs proposed for Final Comment Period (FCP) should meet the requirements outlined in the checklist prior to being accepted into the spec. This checklist is a bit long, but aims to reduce the number of follow-on MSCs after a feature lands.

SCT members: please check off things you check for, and raise a concern against FCP if the checklist is incomplete. If an item doesn't apply, prefer to check it rather than remove it. Unchecking items is encouraged where applicable.

Checklist:

  • Are appropriate implementation(s)
    specified in the MSC’s PR description?
  • Are all MSCs that this MSC depends on already accepted?
  • For each new endpoint that is introduced:
    • Have authentication requirements been specified?
    • Have rate-limiting requirements been specified?
    • Have guest access requirements been specified?
    • Are error responses specified?
      • Does each error case have a specified errcode (e.g. M_FORBIDDEN) and HTTP status code?
        • If a new errcode is introduced, is it clear that it is new?
  • Will the MSC require a new room version, and if so, has that been made clear?
    • Is the reason for a new room version clearly stated? For example,
      modifying the set of redacted fields changes how event IDs are calculated,
      thus requiring a new room version.
  • Are backwards-compatibility concerns appropriately addressed?
  • Are the endpoint conventions honoured?
    • Do HTTP endpoints use_underscores_like_this?
    • Will the endpoint return unbounded data? If so, has pagination been considered?
    • If the endpoint utilises pagination, is it consistent with
      the appendices?
  • An introduction exists and clearly outlines the problem being solved.
    Ideally, the first paragraph should be understandable by a non-technical audience.
  • All outstanding threads are resolved
    • All feedback is incorporated into the proposal text itself, either as a fix or noted as an alternative
  • While the exact sections do not need to be present,
    the details implied by the proposal template are covered. Namely:
    • Introduction
    • Proposal text
    • Potential issues
    • Alternatives
    • Dependencies
  • Stable identifiers are used throughout the proposal, except for the unstable prefix section
    • Unstable prefixes consider the awkward accepted-but-not-merged state
    • Chosen unstable prefixes do not pollute any global namespace (use “org.matrix.mscXXXX”, not “org.matrix”).
  • Changes have applicable Sign Off from all authors/editors/contributors
  • There is a dedicated "Security Considerations" section which detail
    any possible attacks/vulnerabilities this proposal may introduce, even if this is "None.".
    See RFC3552 for things to think about,
    but in particular pay attention to the OWASP Top Ten.

@github-project-automation github-project-automation bot moved this to Needs idea feedback / initial review in Spec Core Team Backlog Jun 20, 2025
@turt2live turt2live moved this from Needs idea feedback / initial review to Proposed for FCP readiness in Spec Core Team Backlog Jun 20, 2025
@turt2live turt2live removed the needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. label Jun 20, 2025
@turt2live
Copy link
Member Author

With my SCT hat, I've verified the implementations (though welcome second/third opinions)

@turt2live
Copy link
Member Author

This has gone through quite a few rounds of review in various T&S circles, and has healthy code review to show that teams are interested in supporting this feature.

With my SCT hat, I think this is ready for FCP, especially to help encourage more client implementations.

@mscbot fcp merge

@mscbot
Copy link
Collaborator

mscbot commented Jun 26, 2025

Team member @mscbot has proposed to merge this. The next step is review by the rest of the tagged people:

Concerns:

  • General clarity/understanding of goals and alternatives

Once at least 75% of reviewers approve (and there are no outstanding concerns), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for information about what commands tagged team members can give me.

@mscbot mscbot added proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the final comment period. disposition-merge labels Jun 26, 2025
@turt2live turt2live moved this from Proposed for FCP readiness to Ready for FCP ticks in Spec Core Team Backlog Jun 26, 2025
Comment on lines +33 to +34
If the sender is allowed to redact, the redaction behaviour continues until the membership event itself
is redacted (thus removing the field), another membership event removes the field, or the flag is set
Copy link
Member

Choose a reason for hiding this comment

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

Why redact the event itself instead of just stopping at it?

Copy link
Member Author

Choose a reason for hiding this comment

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

err, sorry: the membership event is not redacted by the autoredaction stuff. It's just that since we're doing this without a room version, the flag is at risk of being redacted off the event (technically).

We otherwise keep redacting after the ban because of eventual consistency and delayed receipt of events.

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 this says the opposite?

until the membership event itself is redacted

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 can see how that might be interpreted that way, but it is not the intention. It's trying to clarify to server implementations that they won't be able to see the redact_events flag on the event if the membership event itself is redacted, and therefore the autoredact behaviour also ceases at that point in time.

Copy link
Member

Choose a reason for hiding this comment

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

I've read this a handful of times now and I can't interpret it any other way.

Suggested change
If the sender is allowed to redact, the redaction behaviour continues until the membership event itself
is redacted (thus removing the field), another membership event removes the field, or the flag is set
If the sender is allowed to redact, the redaction behaviour continues until a membership event for
that user is reached which does not have the flag set or has the flag set

redactions will "make it" over federation to another server. This is why mass redaction approaches
are preferred, as they are significantly more reliable.

## Potential issues
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this potentially have weird behavior if a server redacts the events, redacts the membership event itself, then backfills events? It is unclear to me if this is covered the text below (or above in fallback behavior?)

Copy link
Member Author

Choose a reason for hiding this comment

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

it should be covered in the potential issues, but I'll aim to clarify in the text. The short version is: yes, it's weird, but not any more weird than usual. A server which requests events from a server that redacted them will receive redacted copies. This infectious behaviour is a feature, though if a server really wanted to it could ask other servers until it finds an unredacted copy.

Copy link
Member

Choose a reason for hiding this comment

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

I'm worried about the opposite -- receiving unredacted events and not knowing they should be redacted.

Copy link
Member Author

Choose a reason for hiding this comment

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

That should already be addressed in the MSC, as a known limitation.

Comment on lines +27 to +31
Similar to regular redactions, if the sender of the membership event can't actually redact the target's
events, the redaction doesn't apply. This means having a power level higher than or equal to `redacts`
*and* `events["m.room.redaction"]` (if set). We maintain the `events` check despite not actually sending
events of that type to keep the same expectations within rooms. If the sender doesn't have permission
to redact an event normally, no redaction is applied.
Copy link
Member

Choose a reason for hiding this comment

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

Can a user send this when leaving a room? Not in the case of kick but to self redact all.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, self-leaves are not permitted by this MSC. Rationale being it opens a can of worms I'd rather not get this MSC stuck in.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I think that's unclear that the behavior only applies if the sender and state key don't match then.

a dedicated event to clean up the spam. In a typical case, a user will get kicked/banned from a room
and the moderators will further redact some or all of their messages. Mass redactions have more use
cases, but the specific case of "redact everything upon ban" is something which may be easily backported
to existing 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 don't think I'm quite getting this proposal. So it's just a temporary measure to do mass redactions in old room versions? Why not just a separate 'mass redact' endpoint? Or, for that matter, have the HS look for mass redact events sent into old room versions and do them manually exactly as it would do here?

Copy link
Contributor

@Gnuxie Gnuxie Jun 27, 2025

Choose a reason for hiding this comment

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

MSC4194 is a prior exploration of a mass redact endpoint for this use case. A reason for collecting the responsibilities into a flag on the ban event are because of the following complications:

  • The homeserver applying redactions would also need to send redactions for future soft failed events as well as already received historical events.
    • Toggling this behavior is complicated: should a user rejoin, the behavior would probably need to be tied to membership in the same way as in this proposal.
  • The endpoint will always be used after a room member is banned. There isn't another use case with exception of self redaction which is intentionally being ignored by both proposals.
  • Without mass redaction events, federating individual redaction events takes longer than a single ban event which can flag to clients to hide all content associated with a user before redaction events arrive. Which is critical in spam attacks1.

Footnotes

  1. And also consider that soft failure is common and it's not likely that there will be just "one" mass redact event needed to cleanup per spam incident.

Copy link
Member Author

Choose a reason for hiding this comment

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

As Gnuxie mentions, we can't/shouldn't be sending 1:1 redaction events anymore, especially post-ban (the original sender can't "self-redact", and the moderator who did the ban may have left). This MSC specifically tries to reduce the number of redaction events to zero if it can, or one in the worst case - mass redactions themselves would be the "one" case.

The issue with mass redact events is that they aren't backwards compatible to existing room versions, which will cause breakage. We could spend some time trying to fix this (fallback fields, different event types, etc), but those solutions don't look as great (in my opinion) and slow down the rollout of the feature due to broader use cases needing consideration.

We (T&S) expect that both redact-on-ban and mass redactions will be used in future room versions concurrently for different use cases, and require a more immediate solution to 1:1 redaction event sending.

I'll cover this in the alternatives section when I loop back around for an edit.

Copy link
Member

Choose a reason for hiding this comment

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

I'm afraid I may be more confused if anything. I was assuming the HS would do something to make this backwards compatible but now I wonder if I've misunderstood that. What makes this backwards compatible given a mass redaction isn't? If this is not a short-term measure, in what circumstances would this be used vs a mass redaction? In any case, hopefully the edit should make things clearer. The info in the responses here probably needs to go into the MSC.

`true`, causes servers (and clients) to redact all of the user's events as though they received an
[`m.room.redaction`](https://spec.matrix.org/v1.14/client-server-api/#mroomredaction), including
adding [`redacted_because`](https://spec.matrix.org/v1.14/client-server-api/#redactions) to `unsigned`
where applicable. An `m.room.redaction` event is not actually sent, however.

Choose a reason for hiding this comment

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

Later on in the proposal, it's said several times that sending redactions as fallback support is intended, so I'm getting mixed signals here. When this flag is passed, should the server send actual redactions or not? I assume it's "yes, send actual redactions, until greater adoption makes them redundant" from later paragraphs, however it is not clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

"yes, send actual redactions, until greater adoption makes them redundant"

If this is the implication then it shouldn't be. Redactions will always need to be sent in legacy room versions. And if the proposal has been written with otherwise then that's a pretty serious issue. @turt2live could you please clarify?

My understanding was that redaction events would have to be sent for all room versions prior to the inclusion of MSC4298.

Copy link
Member Author

Choose a reason for hiding this comment

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

TLDR: "yes, send actual redactions if you want to, until greater adoption makes them redundant" (added emphasis mine) is accurate.


Fallback behaviour is a bit of an awkward case for MSCs. In this case, the intended change is meant to be additive to the spec with no actual requirement to send redaction events (even in existing room versions), but there are several implementations of Matrix clients and servers which already exist today that won't know how to handle this new behaviour, and thus senders are encouraged (not required) to send "fallback redactions".

The MSC does give some guidance on what fallback behaviour might look like, but leaves removal of that fallback behaviour up to the individual projects. One project may, for example, decide that pre-MSC4298 rooms will forever get fallback redactions while another decides that 3 months from spec release there is enough client implementations to safely drop the fallback support. Some implementations may also choose somewhere in the middle of that spectrum: instead of chasing events and retrying redactions, it could do a single query and send redactions once, leaving any errors to hopefully be picked up by the redact-on-ban flag.

Neither this MSC or MSC4298 make the fallback behaviour required, either for existing room versions or implementations of Matrix.

@turt2live
Copy link
Member Author

@mscbot concern General clarity/understanding of goals and alternatives

@mscbot mscbot added the unresolved-concerns This proposal has at least one outstanding concern label Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API disposition-merge kind:core MSC which is critical to the protocol's success proposal A matrix spec change proposal proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the final comment period. safety unresolved-concerns This proposal has at least one outstanding concern
Projects
Status: Ready for FCP ticks
Development

Successfully merging this pull request may close these issues.

7 participants