Skip to content

Conversation

@turt2live
Copy link
Member

Warning

Content Warning: This proposal discuses and identifies harmful content, but does not attempt to describe the harm posed in detail. This includes identifiers for child safety, sexual abuse, self-harm, and other types of harm a user may encounter on the open internet.


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.

@turt2live turt2live changed the title MSC: M_SAFETY error code MSC4387: M_SAFETY error code Dec 9, 2025
Copy link
Member Author

Choose a reason for hiding this comment

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

Implementation requirements:

  • Server returning new error code on (doesn't have to be the same server for each):
    • Room directory
    • Sending events (ideally via a policy server)
    • Media uploads and downloads
  • Client reacting to harms on (doesn't have to be the same client for each either):
    • Room directory
    • Sending events
    • Media uploads and downloads
  • Client unaware of M_SAFETY responding reasonably well to the new error code (ie: doesn't crash, even if the error message given to the user is a bit ugly)

Choose a reason for hiding this comment

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

Anything based on Rory&::LibMatrix would probably not crash, assuming the client implementer actually does error handling and doesn't either re-throw or fall through unknown errors. Not sure if this counts as "Client unaware of M_SAFETY doesn't crash"?

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 certainly helps. With my SCT hat rather than author hat on though, I'd want to see the end client not crashing rather than the library being safe. Usually the requirement is met around the same time as error code implementation because the "before" state can usually be tested pretty quickly.

Copy link
Contributor

@Half-Shot Half-Shot Dec 10, 2025

Choose a reason for hiding this comment

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

I plan to implement this in matrix-js-sdk explicitly, but even so I'm sure Element Web for ex will be fine with unexpected errcodes and formats.

SDK-PR: matrix-org/matrix-js-sdk#5107

Copy link
Contributor

Choose a reason for hiding this comment

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

Element Web now has an impl in draft element-hq/element-web#31558. It currently only handles message failures for the moment, due to the complexity to get this off the ground.

@turt2live turt2live added proposal A matrix spec change proposal s2s Server-to-Server API (federation) 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 Dec 9, 2025
@turt2live turt2live marked this pull request as ready for review December 9, 2025 22:04

Choose a reason for hiding this comment

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

Anything based on Rory&::LibMatrix would probably not crash, assuming the client implementer actually does error handling and doesn't either re-throw or fall through unknown errors. Not sure if this counts as "Client unaware of M_SAFETY doesn't crash"?


* `m.adult`
* `m.adult.sexual_abuse`
* `m.adult.ncii` - "Non-Consensual Intimate Imagery"

Choose a reason for hiding this comment

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

When would this be returned, and depending on the answer, how does one define consent (in terms of matrix spec, not the meaning of consent itself)?

Copy link
Member Author

Choose a reason for hiding this comment

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

NCII is a term used in industry to generally mean "shared with more people than communicated".

Noting that these websites deal with sexual abuse topics, StopNCII, INHOPE, and Meta's Safety Center all describe what this means.

Comment on lines +151 to +152
* `m.adult.animal_sexual_abuse`
* `m.adult.sexual_violence`

Choose a reason for hiding this comment

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

I feel like both of these could be merged into sexual abuse? I'm not sure I see a case for separating these in particular. I could be missing context here or just not understand the reasoning behind why these are separate, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Several jurisdictions distinguish between the two, and can often carry different consequences for the offences.

@Half-Shot Half-Shot self-requested a review December 10, 2025 06:45
## Proposal

A new error code, `M_SAFETY` with HTTP 400 status code, is introduced on the following endpoints:

Copy link
Contributor

Choose a reason for hiding this comment

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

I think profile endpoints should also appear here

Copy link
Member Author

Choose a reason for hiding this comment

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

A future MSC is best for adding more endpoints - the list is already pretty ambitious, and making it longer will delay the MSC through the process.

Most of the Client-Server API qualifies for this new error code.

Choose a reason for hiding this comment

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

Wouldn't it be easier to just spec it as a generic code then? (ie. may be thrown from any CS endpoint, rather than being specific to certain endpoints)

Copy link
Member Author

Choose a reason for hiding this comment

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

Not all endpoints will need it, but most of the ones that do are also non-trivial implementations, so we'd have to implement each and every endpoint before this MSC gets merged.

From a process perspective, more MSCs is no bad thing here.


Note that clients can (and SHOULD, where possible) render more detailed error messages than those
provided as `error`. For example, if `harms` contains `m.child_safety.csam`, then the client might
include links to Lucy Faithfull Foundation's [Stop It Now](https://www.stopitnow.org.uk/) support
Copy link
Contributor

Choose a reason for hiding this comment

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

Element Web is unlikely to start allowing you to click on links in errors, but I think a learn more URL in the error would be useful (also for linking to the tos). This would enable us to replace something like the retry button with a link to help resources in the client.

Copy link
Member Author

Choose a reason for hiding this comment

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

This would be the error the client renders instead of the server-provided error, so should be possible (hopefully). Rendering links from error is not expected of clients.

subtyped for slightly more specific use. Where a subtyped harm doesn't apply, the general category
(the first one in each list) should be used instead.

**Spam**
Copy link
Contributor

Choose a reason for hiding this comment

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

When implementing this, I found it challenging to find the right wording for all of these. I will probably lean on the m.org T&S team for help, but we could do with a guide on how to phrase each of these harms to users.

Copy link
Member Author

Choose a reason for hiding this comment

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

this might be more challenging - the MSC avoids assigning definitions to these. Adding phrasing can imply more of a definition than intended.

Something to consider as the MSC evolves, though.

Note that clients can (and SHOULD, where possible) render more detailed error messages than those
provided as `error`. For example, if `harms` contains `m.child_safety.csam`, then the client might
include links to Lucy Faithfull Foundation's [Stop It Now](https://www.stopitnow.org.uk/) support
website. The `error` is provided as fallback and should be understandable to a human user.
Copy link
Contributor

Choose a reason for hiding this comment

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

Noting that Element Web will not allow us to use the server response as it will violate our rules to translate strings (element-hq/element-web#31558 (comment)), so for this we'd have to instead introduce a generic harms statement.

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's expected - will incorporate it into the proposal on the next editing pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. proposal A matrix spec change proposal s2s Server-to-Server API (federation) safety

Projects

Status: Tracking for review

Development

Successfully merging this pull request may close these issues.

7 participants