From cbb75794cd2d7e39c1517862042ed19368183aad Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Mon, 31 Jan 2022 17:59:39 +0100 Subject: [PATCH 1/8] stablize --- docs/modules/password_auth_provider_callbacks.md | 2 +- docs/workers.md | 2 +- synapse/api/constants.py | 2 +- synapse/handlers/ui_auth/__init__.py | 2 +- synapse/rest/client/register.py | 4 ++-- tests/rest/client/test_register.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/modules/password_auth_provider_callbacks.md b/docs/modules/password_auth_provider_callbacks.md index ec8324d292d8..b423e00575b1 100644 --- a/docs/modules/password_auth_provider_callbacks.md +++ b/docs/modules/password_auth_provider_callbacks.md @@ -148,7 +148,7 @@ Here's an example featuring all currently supported keys: "address": "33123456789", "validated_at": 1642701357084, }, - "org.matrix.msc3231.login.registration_token": "sometoken", # User has registered through the flow described in MSC3231 + "m.login.registration_token": "sometoken", # User has registered through registration tokens } ``` diff --git a/docs/workers.md b/docs/workers.md index fd83e2ddeb1f..dadde4d7265d 100644 --- a/docs/workers.md +++ b/docs/workers.md @@ -241,7 +241,7 @@ expressions: # Registration/login requests ^/_matrix/client/(api/v1|r0|v3|unstable)/login$ ^/_matrix/client/(r0|v3|unstable)/register$ - ^/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity$ + ^/_matrix/client/v1/register/m.login.registration_token/validity$ # Event sending requests ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact diff --git a/synapse/api/constants.py b/synapse/api/constants.py index 52c083a20b9c..36ace7c6134f 100644 --- a/synapse/api/constants.py +++ b/synapse/api/constants.py @@ -81,7 +81,7 @@ class LoginType: TERMS: Final = "m.login.terms" SSO: Final = "m.login.sso" DUMMY: Final = "m.login.dummy" - REGISTRATION_TOKEN: Final = "org.matrix.msc3231.login.registration_token" + REGISTRATION_TOKEN: Final = "m.login.registration_token" # This is used in the `type` parameter for /register when called by diff --git a/synapse/handlers/ui_auth/__init__.py b/synapse/handlers/ui_auth/__init__.py index 13b0c61d2e20..56eee4057f44 100644 --- a/synapse/handlers/ui_auth/__init__.py +++ b/synapse/handlers/ui_auth/__init__.py @@ -38,4 +38,4 @@ class UIAuthSessionDataConstants: # used during registration to store the registration token used (if required) so that: # - we can prevent a token being used twice by one session # - we can 'use up' the token after registration has successfully completed - REGISTRATION_TOKEN = "org.matrix.msc3231.login.registration_token" + REGISTRATION_TOKEN = "m.login.registration_token" diff --git a/synapse/rest/client/register.py b/synapse/rest/client/register.py index e3492f9f9399..b75f0817ed20 100644 --- a/synapse/rest/client/register.py +++ b/synapse/rest/client/register.py @@ -368,7 +368,7 @@ class RegistrationTokenValidityRestServlet(RestServlet): Example: - GET /_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity?token=abcd + GET /_matrix/client/v1/register/m.login.registration_token/validity?token=abcd 200 OK @@ -378,7 +378,7 @@ class RegistrationTokenValidityRestServlet(RestServlet): """ PATTERNS = client_patterns( - f"/org.matrix.msc3231/register/{LoginType.REGISTRATION_TOKEN}/validity", + f"/v1/register/{LoginType.REGISTRATION_TOKEN}/validity", releases=(), unstable=True, ) diff --git a/tests/rest/client/test_register.py b/tests/rest/client/test_register.py index 407dd32a7383..0f1c47dcbb87 100644 --- a/tests/rest/client/test_register.py +++ b/tests/rest/client/test_register.py @@ -1154,7 +1154,7 @@ def test_background_job(self): class RegistrationTokenValidityRestServletTestCase(unittest.HomeserverTestCase): servlets = [register.register_servlets] - url = "/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity" + url = "/_matrix/client/v1/register/m.login.registration_token/validity" def default_config(self): config = super().default_config() From f6bbd3fb667cbb78eab0dad633cd17e5fc8bf40e Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Mon, 31 Jan 2022 18:04:12 +0100 Subject: [PATCH 2/8] add news --- changelog.d/11867.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/11867.feature diff --git a/changelog.d/11867.feature b/changelog.d/11867.feature new file mode 100644 index 000000000000..8432b54e6fd4 --- /dev/null +++ b/changelog.d/11867.feature @@ -0,0 +1 @@ +Stabilize MSC3231. \ No newline at end of file From 88834ec75be3fcc309e1c1c9c94aa9c3bfee57ab Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Mon, 31 Jan 2022 18:10:05 +0100 Subject: [PATCH 3/8] whoops --- synapse/rest/client/register.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/synapse/rest/client/register.py b/synapse/rest/client/register.py index b75f0817ed20..e0dbbb38ad07 100644 --- a/synapse/rest/client/register.py +++ b/synapse/rest/client/register.py @@ -379,8 +379,7 @@ class RegistrationTokenValidityRestServlet(RestServlet): PATTERNS = client_patterns( f"/v1/register/{LoginType.REGISTRATION_TOKEN}/validity", - releases=(), - unstable=True, + releases=("v1",), ) def __init__(self, hs: "HomeServer"): From 5ee738694f891eaa5fff8a8cd58c3ff74df7a795 Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Mon, 31 Jan 2022 18:11:24 +0100 Subject: [PATCH 4/8] another whoops --- synapse/rest/client/register.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/rest/client/register.py b/synapse/rest/client/register.py index e0dbbb38ad07..c283313e8da3 100644 --- a/synapse/rest/client/register.py +++ b/synapse/rest/client/register.py @@ -378,7 +378,7 @@ class RegistrationTokenValidityRestServlet(RestServlet): """ PATTERNS = client_patterns( - f"/v1/register/{LoginType.REGISTRATION_TOKEN}/validity", + f"/register/{LoginType.REGISTRATION_TOKEN}/validity", releases=("v1",), ) From cc92c72d860871852b589048d5ef5d9b24d9a233 Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Mon, 31 Jan 2022 19:55:10 +0100 Subject: [PATCH 5/8] Update docs/modules/password_auth_provider_callbacks.md Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> --- docs/modules/password_auth_provider_callbacks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/password_auth_provider_callbacks.md b/docs/modules/password_auth_provider_callbacks.md index b423e00575b1..3697e3782ec3 100644 --- a/docs/modules/password_auth_provider_callbacks.md +++ b/docs/modules/password_auth_provider_callbacks.md @@ -148,7 +148,7 @@ Here's an example featuring all currently supported keys: "address": "33123456789", "validated_at": 1642701357084, }, - "m.login.registration_token": "sometoken", # User has registered through registration tokens + "m.login.registration_token": "sometoken", # User has registered through a registration token } ``` From 54d841f989821ca9d43f1652dae4e1a51b70fa7f Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Mon, 31 Jan 2022 20:02:58 +0100 Subject: [PATCH 6/8] apply review feedback --- changelog.d/11867.feature | 6 +++++- docs/upgrade.md | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/changelog.d/11867.feature b/changelog.d/11867.feature index 8432b54e6fd4..dbd9de0e4cf7 100644 --- a/changelog.d/11867.feature +++ b/changelog.d/11867.feature @@ -1 +1,5 @@ -Stabilize MSC3231. \ No newline at end of file +Stabilize [MSC3231](https://github.com/matrix-org/matrix-doc/pull/3231). + +Client implementations using `m.login.registration_token` should switch to the stable identifiers: +* `org.matrix.msc3231.login.registration_token` in query parameters and request/response bodies becomes `m.login.registration_token`. +* `/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity` becomes `/_matrix/client/v1/register/m.login.registration_token/validity`. \ No newline at end of file diff --git a/docs/upgrade.md b/docs/upgrade.md index f455d257babf..a0990b58f4cd 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -84,6 +84,20 @@ process, for example: wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb ``` +# Upgrading to v1.(next) + +## Stablisation of MSC3231 + +A reverse proxy rule needs to be updated; + +`^/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity$` + +To + +`^/_matrix/client/v1/register/m.login.registration_token/validity$` + +Any currently-active UIA session where a user is registering with a +registration token will be invalidated. # Upgrading to v1.51.0 From d3ad0e85bbc882720b2e82a3b49e863ccf7ad6ab Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Thu, 3 Feb 2022 19:35:33 +0100 Subject: [PATCH 7/8] apply review feedback --- docs/upgrade.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/upgrade.md b/docs/upgrade.md index a0990b58f4cd..39bf0bed94c4 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -88,16 +88,17 @@ process, for example: ## Stablisation of MSC3231 -A reverse proxy rule needs to be updated; +The unstable validity-check endpoint for the +[Registration Tokens](https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv1registermloginregistration_tokenvalidity) +feature has been stabilised and moved from: `^/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity$` -To +to: `^/_matrix/client/v1/register/m.login.registration_token/validity$` -Any currently-active UIA session where a user is registering with a -registration token will be invalidated. +Please update any relevant reverse proxy or firewall configurations appropriately. # Upgrading to v1.51.0 From de2b8810da8270371cdb6d66950d0a23ca33c39b Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Fri, 4 Feb 2022 11:19:41 +0000 Subject: [PATCH 8/8] Switch regular expressions to plain endpoint paths --- docs/upgrade.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/upgrade.md b/docs/upgrade.md index 39bf0bed94c4..e85ad454eb17 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -92,11 +92,11 @@ The unstable validity-check endpoint for the [Registration Tokens](https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv1registermloginregistration_tokenvalidity) feature has been stabilised and moved from: -`^/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity$` +`/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity` to: -`^/_matrix/client/v1/register/m.login.registration_token/validity$` +`/_matrix/client/v1/register/m.login.registration_token/validity` Please update any relevant reverse proxy or firewall configurations appropriately.