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

MSC3823: Account Suspension #3823

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
119 changes: 50 additions & 69 deletions proposals/3823-code-for-account-suspension.md
Copy link
Member

@turt2live turt2live May 1, 2024

Choose a reason for hiding this comment

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

Implementation requirements:

Copy link
Member

@turt2live turt2live Sep 30, 2024

Choose a reason for hiding this comment

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

The client implementation requirement has been questioned a bit - I think for this MSC, evidence of clients not exploding would be fine. The list won't be exhaustive or fully representative of the ecosystem, but would indicate the typical user experience.

Specifically, I think the following clients need to be tested with a suspended account:

  • Element Web
  • Element X (iOS or Android, or both)
  • Cinny
  • FluffyChat
  • Nheko

"Exploding" would be defined as the user being logged out, or otherwise unable to interact with their account. Failing to show the error message ("your account is suspended") is fine, but bonus points to the client if it makes it clear to the user. If the user can (minimally) interact with their rooms without being kicked to an error screen or login page, the client "works", even if clunky.

Copy link
Member

Choose a reason for hiding this comment

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

This testing has been completed by the T&S team at the Foundation. Results are compiled here: https://docs.google.com/document/d/1oTVKRLHCc6x4iYti8bkhRN3YbBO29oAjqmZE-mj-xXY/edit?usp=sharing

TLDR: The above-listed clients all passed, but a few had some weird-ish errors/rough edges. With my SCT hat, I don't think these rough edges are blockers for merging.

Original file line number Diff line number Diff line change
@@ -1,85 +1,66 @@
# MSC3823: A code for account suspension
# MSC3823: Account Suspension

This MSC introduces a new error code that servers may send to clarify that an account has been
suspended *temporarily* but may still be reactivated.
Unlike [account locking](https://github.com/matrix-org/matrix-spec-proposals/pull/3939), suspension
allows the user to have a (largely) readonly view of their account. Homeserver administrators and
moderators may use this functionality to temporarily deactivate an account, or place conditions on
the account's experience. Critically, like locking, account suspension is reversible, unlike the
deactivation mechanism currently available in Matrix - a destructive, irreversible, action.

turt2live marked this conversation as resolved.
Show resolved Hide resolved
## Proposal

### Introduction

Matrix has a code `M_USER_DEACTIVATED` that a server may return to describe an account that has been
deactivated. So far, this code has been used to represent accounts that have been *permanently*
deactivated. In particular, clients that interpret this error code display it imply that the account
has been *permanently* deactivated.

However, some countries (e.g. UK) have laws that require the ability to appeal account
deactivations. This requires the ability to specify that an account is *reversibly*
suspended and let users know about the appeals procedure.

This MSC simply introduces a new error code `M_USER_ACCOUNT_SUSPENDED` that servers may send to
clarify that an account has been suspended but that the solution may still be resolved either by
an appeal or by e.g. clearing up some abusive messages.

This MSC does *not* specify a mechanism to suspend or unsuspend the account or to handle appeals.

### Proposal

Introduce a new error code `M_USER_ACCOUNT_SUSPENDED`. This error code MAY be sent by the server
whenever a client attempts to use an API on behalf of a user whose account has been suspended.
This proposal introduces an error code for communicating suspension to a user, alongside some
guidelines for how suspension could be implemented by a server. APIs to invoke or clear suspension
are not introduced, and left as an implementation detail. These will typically be done through an
administrator-only API.

| Name | Type | Value |
|------|------|-------|
| `href` | string | (optional) If specified, a URL containing more information for the user, such as action needed. |

The client is in charge of displaying an error message understandable by the user in case of `M_USER_ACCOUNT_SUSPENDED`,
as well as a link to `href`.

The web server serving `href` is in charge of localizing the message, using existing HTTP mechanisms,
to adapt the page to the end user's locale.

#### Examples

Returning a static page:

```json
{
"errcode": "M_USER_ACCOUNT_SUSPENDED",
"error": "The user account has been suspended, see link for details",
"href": "https://example.org/help/my-account-is-suspended-what-can-i-do"
}
```

Returning a dynamic page customized for this specific user:
## Proposal

```json
{
"errcode": "M_USER_ACCOUNT_SUSPENDED",
"error": "The user account has been suspended, see link for details",
"href": "https://example.org/action-needed/please-redact-events?event-id=$event_1:example.org&event-id=$event_2:example.org"
}
```
When an account is suspended, any [Client-Server API](https://spec.matrix.org/v1.10/client-server-api/)
endpoint MAY return a 403 HTTP status code with `errcode` of `M_USER_SUSPENDED`. This indicates to
the user that the associated action is unavailable.
turt2live marked this conversation as resolved.
Show resolved Hide resolved

Comment on lines +21 to +23
Copy link
Member

Choose a reason for hiding this comment

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

someone remind me why this should be a 403 rather than a 401 (and why does locking specify a 401)?

Copy link
Member

Choose a reason for hiding this comment

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

401 is "token doesn't work anymore" while 403 is "your token works, but server says no".

Clients should note that for more general endpoints, like `/send/:eventType`, suspension MAY only be
applied to a subset of request parameters. For example, a user may be allowed to *redact* events but
not send messages.

### Potential issues
The specific list of permitted actions during suspension is left as a deliberate implementation
detail, however a server SHOULD permit the user to:

See security considerations.
* Log in/create additional sessions (which should also behave as suspended).
* See and receive messages, particularly via `/sync` and `/messages`.
* [Verify their other devices](https://spec.matrix.org/v1.10/client-server-api/#device-verification)
turt2live marked this conversation as resolved.
Show resolved Hide resolved
and write associated [cross-signing data](https://spec.matrix.org/v1.10/client-server-api/#cross-signing).
* [Populate their key backup](https://spec.matrix.org/v1.10/client-server-api/#server-side-key-backups).
* Leave rooms & reject invites.
* Redact events.
* Log out/delete any device of theirs, including the current session.
turt2live marked this conversation as resolved.
Show resolved Hide resolved
* Deactivate their account, potentially with a deliberate time delay to discourage making a new
account right away.
* Change or add [admin contacts](https://spec.matrix.org/v1.10/client-server-api/#adding-account-administrative-contact-information),
but not remove.
turt2live marked this conversation as resolved.
Show resolved Hide resolved

### Alternatives
The suggested set of explicitly forbidden actions is:

We could reuse `M_USER_DEACTIVATED` and introduce an additional field:
* Joining or knocking on rooms, including accepting invites.
* Sending messages.
* Sending invites.
turt2live marked this conversation as resolved.
Show resolved Hide resolved
* Changing profile data (display name and avatar).

| Name | Type | Value |
|------|------|-------|
| `permanent` | boolean | (optional) If `false`, the account may still be reactivated. |
## Potential issues

in addition to the fields mentioned previously.
This proposal does not communicate *why* a user's account is restricted. The human-readable `error`
field may contain some information, though anything comprehensive may not be surfaced to the user.
A future MSC is expected to build a system for both informing the user of the action taken against
their account and allow the user to appeal that action.

### Security considerations
## Alternatives

This has the potential to expose private data.
No significant alternatives are plausible. `M_USER_DEACTIVATED` could be expanded with a `permanent`
flag, though ideally each error code should provide meaning on its own.

To avoid this, any `M_USER_ACCOUNT_SUSPENDED` MUST NOT be sent without authentication.
The related concept of locking, as discussed in places like [MSC3939](https://github.com/matrix-org/matrix-spec-proposals/pull/3939)
and [matrix-org/glossary](https://github.com/matrix-org/glossary), is semantically different from
suspension.

Comment on lines +70 to +72
Copy link
Member

Choose a reason for hiding this comment

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

I think this is still very confusing -- as a server operator I would constantly be unsure whether to lock or suspend an account. It is unclear when they would be used. From the glossary (which I don't know if it is anything official or not?) it says:

Account locking: User is unable to log in to their account, and it is preserved in-place. This action is reversible.
Account suspension: Similar to locking, though the user can still log in and read their account. Writes are not possible. This action is reversible.

Which sounds to me like the only difference is users being able to login or not. I don't understand the differentiation.

Choose a reason for hiding this comment

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

An example for each might help:

  • As a server admin, you detect unusual login activity for a user. While you investigate, you lock the account.
  • As a server admin, you receive a number of reports about a user posting content that is against your Terms of Service. You suspend the user - this could be until they remove the offending content, until they successfully appeal your decision, or until a set period of time elapses, whatever you decide/your Terms of Service state.

Locking is for scenarios where preventing any activity is important. It's a narrower use case, but there is overlap where you might reach for either locking or suspension.

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 bunch of times and can't really figure out the difference from either an operator or user point of view.

@mscbot concern Confusion/overlap with account locking is unclear.

Copy link
Member

Choose a reason for hiding this comment

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

(did Jim's comment help, or is it still confusing? I'm struggling to figure out how to add clarity here, honestly)

Copy link
Member

Choose a reason for hiding this comment

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

It didn't help clarify. It mostly felt like synonyms were being used. E.g. Why not just lock the account for a period of time or during investigation?

Copy link
Member

Choose a reason for hiding this comment

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

Seems like using M_USER_ACCESS_LIMITED or something like that would be ok?

Copy link
Member

Choose a reason for hiding this comment

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

Given the widespread use of "suspended", I'm heavily inclined to follow that precedent.

I'll add some text to the proposal to clarify locking vs suspension in any case.

Copy link
Member

@KitsuneRal KitsuneRal Nov 7, 2024

Choose a reason for hiding this comment

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

Getting back to the subject of distinct error codes: okay, we have a certain set of permissions (forbiddings?) for these two, what happens when we happen to need one more level (e.g. only allowed to change the password but not anything else, even redaction)? Do we state that the fundamental difference between "locked" and "suspended" is ability to log in but as long as a user can log in, the rest is shades of "suspended"? As a client author, I would really like to advise the user what they can and cannot do, without them trying and failing.

Copy link
Member

@KitsuneRal KitsuneRal Nov 7, 2024

Choose a reason for hiding this comment

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

To clarify: I'd really prefer this to be future-proof, i.e. if we need to introduce additional levels of access (either for safety or for security purposes) or if different homeservers end up providing different levels of access to suspended users, the solution should be able to incorporate it.

Copy link
Member

Choose a reason for hiding this comment

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

Improving communication to the user on what they can/can't do is planned for a future MSC as part of a regulatory compliance series relating to T&S. I'd encourage us to think about sub-codes or similar at that stage rather than delaying a needed feature.

### Unstable prefixes
## Unstable prefixes

During testing, `M_USER_ACCOUNT_SUSPENDED` will be prefixed as `ORG.MATRIX.MSC3823.USER_ACCOUNT_SUSPENDED`.
Until this proposal is considered stable, implementations must use
`ORG.MATRIX.MSC3823.USER_SUSPENDED` instead of `M_USER_SUSPENDED`.
Loading