|
| 1 | +# MSC1692: Terms of service at registration |
| 2 | + |
| 3 | +At registration, homeservers may wish to require the user to accept a given set of policy documents, |
| 4 | +such as a terms of service and privacy policy. There may be many different types of documents, all of |
| 5 | +which are versioned and presented in (potentially) multiple languages. |
| 6 | + |
| 7 | +This proposal covers requiring users to accept the list of documents during registration. Future |
| 8 | +improvements could include informing the user *after* registration that a document has changed, which |
| 9 | +has been spun out to [MSC3012](https://github.com/matrix-org/matrix-spec-proposals/pull/3012). |
| 10 | + |
| 11 | +## Proposal |
| 12 | + |
| 13 | +The [User-Interactive Authentication](https://spec.matrix.org/v1.9/client-server-api/#user-interactive-authentication-api) |
| 14 | +API (UIA) is currently used during registration to create a new account. In future, it is expected |
| 15 | +that OIDC will be used instead, which can include support for this MSC's principles without needing |
| 16 | +to change the Matrix specification itself. As a measure until OIDC is here though, this MSC exists |
| 17 | +to fill the need. |
| 18 | + |
| 19 | +A new `m.login.terms` authentication type is introduced, allowing servers to include it in registration |
| 20 | +flows if it desires. Servers which do not require policy acceptance at registration are not required |
| 21 | +to support this flow. |
| 22 | + |
| 23 | +The parameters for the new authentication type look like the following: |
| 24 | + |
| 25 | +```json |
| 26 | +{ |
| 27 | + "policies": { |
| 28 | + "terms_of_service": { |
| 29 | + "version": "1.2", |
| 30 | + "en": { |
| 31 | + "name": "Terms of Service", |
| 32 | + "url": "https://example.org/somewhere/terms-1.2-en.html" |
| 33 | + }, |
| 34 | + "fr": { |
| 35 | + "name": "Conditions d'utilisation", |
| 36 | + "url": "https://example.org/somewhere/terms-1.2-fr.html" |
| 37 | + } |
| 38 | + }, |
| 39 | + "privacy_policy": { |
| 40 | + "version": "1.2", |
| 41 | + "en": { |
| 42 | + "name": "Privacy Policy", |
| 43 | + "url": "https://example.org/somewhere/privacy-1.2-en.html" |
| 44 | + }, |
| 45 | + "fr": { |
| 46 | + "name": "Politique de confidentialité", |
| 47 | + "url": "https://example.org/somewhere/privacy-1.2-fr.html" |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +Each key under `policies` is a "Policy ID", and defined by the server. They are an opaque identifier |
| 55 | +(described later in this proposal). Each policy object associated with the policy ID has a required |
| 56 | +`version` as a convenience to the client, and is another opaque identifier. All other keys are language |
| 57 | +codes to represent the same document. The client picks the language which best suits the user. |
| 58 | + |
| 59 | +Language codes *should* be formatted as per [Section 2.2 of RFC 5646](https://datatracker.ietf.org/doc/html/rfc5646#section-2.2), |
| 60 | +noting that some implementation *may* use an underscore instead of dash. For example, `en_US` instead |
| 61 | +of `en-US`. This recommendation is to ensure maximum compatibility with existing conventions around |
| 62 | +language choices in (Matrix) clients. |
| 63 | + |
| 64 | +`name` and `url` for each policy document are required, and are arbitrary strings with no maximum |
| 65 | +length. `url` *must* be a valid URI with scheme `https://` or `http://`. Insecure HTTP is discouraged. |
| 66 | + |
| 67 | +If a client encounters an invalid parameter, registration should stop with an error presented to the |
| 68 | +user. |
| 69 | + |
| 70 | +To complete the stage, accepting *all* of the listed documents, the client submits an empty `auth` |
| 71 | +dict. The client *should* present the user with a checkbox to accept each policy, including a link |
| 72 | +to the provided `url`, or otherwise rely on [fallback auth](https://spec.matrix.org/v1.9/client-server-api/#fallback). |
| 73 | + |
| 74 | +The server is expected to track which document versions it presented to the user during registration, |
| 75 | +if applicable. |
| 76 | + |
| 77 | +### Opaque identifier |
| 78 | + |
| 79 | +This definition is inherited from [MSC1597](https://github.com/matrix-org/matrix-spec-proposals/pull/1597). |
| 80 | + |
| 81 | +> Opaque IDs must be strings consisting entirely of the characters |
| 82 | +> `[0-9a-zA-Z._~-]`. Their length must not exceed 255 characters and they must |
| 83 | +> not be empty. |
| 84 | +
|
| 85 | +## Unstable prefix |
| 86 | + |
| 87 | +Regrettably, this MSC was implemented with *stable* identifiers before an unstable identifiers process |
| 88 | +was established. Implementation has existed in some capacity since 2018: https://github.com/matrix-org/synapse/pull/4004 |
| 89 | + |
| 90 | +Noting that the modern MSC process forbids such behaviour, new implementations should use the stable |
| 91 | +`m.login.terms` identifier regardless of MSC status. If the MSC changes in a breaking way, a new |
| 92 | +identifier *must* be chosen, and *must* include a proper unstable prefix. |
0 commit comments