Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 287108f

Browse files
committed
Merge tag 'v1.42.0rc2' into develop
Synapse 1.42.0rc2 (2021-09-06) ============================== This version of Synapse removes deprecated room-management admin APIs, removes out-of-date email pushers, and improves error handling for fallback templates for user-interactive authentication. For more information on these points, server administrators are encouraged to read [the upgrade notes](docs/upgrade.md#upgrading-to-v1420). Features -------- - Support room version 9 from [MSC3375](matrix-org/matrix-spec-proposals#3375). ([\#10747](#10747)) Internal Changes ---------------- - Print a warning when using one of the deprecated `template_dir` settings. ([\#10768](#10768))
2 parents f1c6b76 + ff039df commit 287108f

File tree

9 files changed

+145
-4
lines changed

9 files changed

+145
-4
lines changed

CHANGES.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1-
Synapse 1.42.0rc1 (2021-09-01)
1+
Synapse 1.42.0rc2 (2021-09-06)
22
==============================
33

4-
Server administrators are reminded to read [the upgrade notes](docs/upgrade.md#upgrading-to-v1420).
4+
This version of Synapse removes deprecated room-management admin APIs, removes out-of-date
5+
email pushers, and improves error handling for fallback templates for user-interactive
6+
authentication. For more information on these points, server administrators are
7+
encouraged to read [the upgrade notes](docs/upgrade.md#upgrading-to-v1420).
8+
9+
Features
10+
--------
511

12+
- Support room version 9 from [MSC3375](https://github.com/matrix-org/matrix-doc/pull/3375). ([\#10747](https://github.com/matrix-org/synapse/issues/10747))
13+
14+
15+
Internal Changes
16+
----------------
17+
18+
- Print a warning when using one of the deprecated `template_dir` settings. ([\#10768](https://github.com/matrix-org/synapse/issues/10768))
19+
20+
21+
Synapse 1.42.0rc1 (2021-09-01)
22+
==============================
623

724
Features
825
--------

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
matrix-synapse-py3 (1.42.0~rc2) stable; urgency=medium
2+
3+
* New synapse release 1.42.0~rc2.
4+
5+
-- Synapse Packaging team <[email protected]> Mon, 06 Sep 2021 15:25:13 +0100
6+
17
matrix-synapse-py3 (1.42.0~rc1) stable; urgency=medium
28

39
* New synapse release 1.42.0rc1.

synapse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
except ImportError:
4848
pass
4949

50-
__version__ = "1.42.0rc1"
50+
__version__ = "1.42.0rc2"
5151

5252
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
5353
# We import here so that we don't have to install a bunch of deps when

synapse/api/room_versions.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ class RoomVersion:
7070
msc2176_redaction_rules = attr.ib(type=bool)
7171
# MSC3083: Support the 'restricted' join_rule.
7272
msc3083_join_rules = attr.ib(type=bool)
73+
# MSC3375: Support for the proper redaction rules for MSC3083. This mustn't
74+
# be enabled if MSC3083 is not.
75+
msc3375_redaction_rules = attr.ib(type=bool)
7376
# MSC2403: Allows join_rules to be set to 'knock', changes auth rules to allow sending
7477
# m.room.membership event with membership 'knock'.
7578
msc2403_knocking = attr.ib(type=bool)
@@ -92,6 +95,7 @@ class RoomVersions:
9295
limit_notifications_power_levels=False,
9396
msc2176_redaction_rules=False,
9497
msc3083_join_rules=False,
98+
msc3375_redaction_rules=False,
9599
msc2403_knocking=False,
96100
msc2716_historical=False,
97101
msc2716_redactions=False,
@@ -107,6 +111,7 @@ class RoomVersions:
107111
limit_notifications_power_levels=False,
108112
msc2176_redaction_rules=False,
109113
msc3083_join_rules=False,
114+
msc3375_redaction_rules=False,
110115
msc2403_knocking=False,
111116
msc2716_historical=False,
112117
msc2716_redactions=False,
@@ -122,6 +127,7 @@ class RoomVersions:
122127
limit_notifications_power_levels=False,
123128
msc2176_redaction_rules=False,
124129
msc3083_join_rules=False,
130+
msc3375_redaction_rules=False,
125131
msc2403_knocking=False,
126132
msc2716_historical=False,
127133
msc2716_redactions=False,
@@ -137,6 +143,7 @@ class RoomVersions:
137143
limit_notifications_power_levels=False,
138144
msc2176_redaction_rules=False,
139145
msc3083_join_rules=False,
146+
msc3375_redaction_rules=False,
140147
msc2403_knocking=False,
141148
msc2716_historical=False,
142149
msc2716_redactions=False,
@@ -152,6 +159,7 @@ class RoomVersions:
152159
limit_notifications_power_levels=False,
153160
msc2176_redaction_rules=False,
154161
msc3083_join_rules=False,
162+
msc3375_redaction_rules=False,
155163
msc2403_knocking=False,
156164
msc2716_historical=False,
157165
msc2716_redactions=False,
@@ -167,6 +175,7 @@ class RoomVersions:
167175
limit_notifications_power_levels=True,
168176
msc2176_redaction_rules=False,
169177
msc3083_join_rules=False,
178+
msc3375_redaction_rules=False,
170179
msc2403_knocking=False,
171180
msc2716_historical=False,
172181
msc2716_redactions=False,
@@ -182,6 +191,7 @@ class RoomVersions:
182191
limit_notifications_power_levels=True,
183192
msc2176_redaction_rules=True,
184193
msc3083_join_rules=False,
194+
msc3375_redaction_rules=False,
185195
msc2403_knocking=False,
186196
msc2716_historical=False,
187197
msc2716_redactions=False,
@@ -197,6 +207,7 @@ class RoomVersions:
197207
limit_notifications_power_levels=True,
198208
msc2176_redaction_rules=False,
199209
msc3083_join_rules=False,
210+
msc3375_redaction_rules=False,
200211
msc2403_knocking=True,
201212
msc2716_historical=False,
202213
msc2716_redactions=False,
@@ -212,6 +223,23 @@ class RoomVersions:
212223
limit_notifications_power_levels=True,
213224
msc2176_redaction_rules=False,
214225
msc3083_join_rules=True,
226+
msc3375_redaction_rules=False,
227+
msc2403_knocking=True,
228+
msc2716_historical=False,
229+
msc2716_redactions=False,
230+
)
231+
V9 = RoomVersion(
232+
"9",
233+
RoomDisposition.STABLE,
234+
EventFormatVersions.V3,
235+
StateResolutionVersions.V2,
236+
enforce_key_validity=True,
237+
special_case_aliases_auth=False,
238+
strict_canonicaljson=True,
239+
limit_notifications_power_levels=True,
240+
msc2176_redaction_rules=False,
241+
msc3083_join_rules=True,
242+
msc3375_redaction_rules=True,
215243
msc2403_knocking=True,
216244
msc2716_historical=False,
217245
msc2716_redactions=False,
@@ -227,6 +255,7 @@ class RoomVersions:
227255
limit_notifications_power_levels=True,
228256
msc2176_redaction_rules=False,
229257
msc3083_join_rules=False,
258+
msc3375_redaction_rules=False,
230259
msc2403_knocking=True,
231260
msc2716_historical=True,
232261
msc2716_redactions=False,
@@ -242,6 +271,7 @@ class RoomVersions:
242271
limit_notifications_power_levels=True,
243272
msc2176_redaction_rules=False,
244273
msc3083_join_rules=False,
274+
msc3375_redaction_rules=False,
245275
msc2403_knocking=True,
246276
msc2716_historical=True,
247277
msc2716_redactions=True,
@@ -261,6 +291,7 @@ class RoomVersions:
261291
RoomVersions.V7,
262292
RoomVersions.MSC2716,
263293
RoomVersions.V8,
294+
RoomVersions.V9,
264295
)
265296
}
266297

synapse/config/account_validity.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,20 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
import logging
15+
1416
from synapse.config._base import Config, ConfigError
1517

18+
logger = logging.getLogger(__name__)
19+
20+
LEGACY_TEMPLATE_DIR_WARNING = """
21+
This server's configuration file is using the deprecated 'template_dir' setting in the
22+
'account_validity' section. Support for this setting has been deprecated and will be
23+
removed in a future version of Synapse. Server admins should instead use the new
24+
'custom_templates_directory' setting documented here:
25+
https://matrix-org.github.io/synapse/latest/templates.html
26+
---------------------------------------------------------------------------------------"""
27+
1628

1729
class AccountValidityConfig(Config):
1830
section = "account_validity"
@@ -69,6 +81,8 @@ def read_config(self, config, **kwargs):
6981

7082
# Load account validity templates.
7183
account_validity_template_dir = account_validity_config.get("template_dir")
84+
if account_validity_template_dir is not None:
85+
logger.warning(LEGACY_TEMPLATE_DIR_WARNING)
7286

7387
account_renewed_template_filename = account_validity_config.get(
7488
"account_renewed_html_path", "account_renewed.html"

synapse/config/emailconfig.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
# This file can't be called email.py because if it is, we cannot:
1818
import email.utils
19+
import logging
1920
import os
2021
from enum import Enum
2122
from typing import Optional
@@ -24,6 +25,8 @@
2425

2526
from ._base import Config, ConfigError
2627

28+
logger = logging.getLogger(__name__)
29+
2730
MISSING_PASSWORD_RESET_CONFIG_ERROR = """\
2831
Password reset emails are enabled on this homeserver due to a partial
2932
'email' block. However, the following required keys are missing:
@@ -44,6 +47,14 @@
4447
"email_validation": "[%(server_name)s] Validate your email",
4548
}
4649

50+
LEGACY_TEMPLATE_DIR_WARNING = """
51+
This server's configuration file is using the deprecated 'template_dir' setting in the
52+
'email' section. Support for this setting has been deprecated and will be removed in a
53+
future version of Synapse. Server admins should instead use the new
54+
'custom_templates_directory' setting documented here:
55+
https://matrix-org.github.io/synapse/latest/templates.html
56+
---------------------------------------------------------------------------------------"""
57+
4758

4859
@attr.s(slots=True, frozen=True)
4960
class EmailSubjectConfig:
@@ -105,6 +116,9 @@ def read_config(self, config, **kwargs):
105116

106117
# A user-configurable template directory
107118
template_dir = email_config.get("template_dir")
119+
if template_dir is not None:
120+
logger.warning(LEGACY_TEMPLATE_DIR_WARNING)
121+
108122
if isinstance(template_dir, str):
109123
# We need an absolute path, because we change directory after starting (and
110124
# we don't yet know what auxiliary templates like mail.css we will need).

synapse/config/sso.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,23 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
import logging
1415
from typing import Any, Dict, Optional
1516

1617
import attr
1718

1819
from ._base import Config
1920

21+
logger = logging.getLogger(__name__)
22+
23+
LEGACY_TEMPLATE_DIR_WARNING = """
24+
This server's configuration file is using the deprecated 'template_dir' setting in the
25+
'sso' section. Support for this setting has been deprecated and will be removed in a
26+
future version of Synapse. Server admins should instead use the new
27+
'custom_templates_directory' setting documented here:
28+
https://matrix-org.github.io/synapse/latest/templates.html
29+
---------------------------------------------------------------------------------------"""
30+
2031

2132
@attr.s(frozen=True)
2233
class SsoAttributeRequirement:
@@ -43,6 +54,8 @@ def read_config(self, config, **kwargs):
4354

4455
# The sso-specific template_dir
4556
self.sso_template_dir = sso_config.get("template_dir")
57+
if self.sso_template_dir is not None:
58+
logger.warning(LEGACY_TEMPLATE_DIR_WARNING)
4659

4760
# Read templates from disk
4861
custom_template_directories = (

synapse/events/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ def add_fields(*fields):
104104

105105
if event_type == EventTypes.Member:
106106
add_fields("membership")
107+
if room_version.msc3375_redaction_rules:
108+
add_fields("join_authorised_via_users_server")
107109
elif event_type == EventTypes.Create:
108110
# MSC2176 rules state that create events cannot be redacted.
109111
if room_version.msc2176_redaction_rules:

tests/events/test_utils.py

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def test_join_rules(self):
322322
},
323323
)
324324

325-
# After MSC3083, alias events have no special behavior.
325+
# After MSC3083, the allow key is protected from redaction.
326326
self.run_test(
327327
{
328328
"type": "m.room.join_rules",
@@ -344,6 +344,50 @@ def test_join_rules(self):
344344
room_version=RoomVersions.V8,
345345
)
346346

347+
def test_member(self):
348+
"""Member events have changed behavior starting with MSC3375."""
349+
self.run_test(
350+
{
351+
"type": "m.room.member",
352+
"event_id": "$test:domain",
353+
"content": {
354+
"membership": "join",
355+
"join_authorised_via_users_server": "@user:domain",
356+
"other_key": "stripped",
357+
},
358+
},
359+
{
360+
"type": "m.room.member",
361+
"event_id": "$test:domain",
362+
"content": {"membership": "join"},
363+
"signatures": {},
364+
"unsigned": {},
365+
},
366+
)
367+
368+
# After MSC3375, the join_authorised_via_users_server key is protected
369+
# from redaction.
370+
self.run_test(
371+
{
372+
"type": "m.room.member",
373+
"content": {
374+
"membership": "join",
375+
"join_authorised_via_users_server": "@user:domain",
376+
"other_key": "stripped",
377+
},
378+
},
379+
{
380+
"type": "m.room.member",
381+
"content": {
382+
"membership": "join",
383+
"join_authorised_via_users_server": "@user:domain",
384+
},
385+
"signatures": {},
386+
"unsigned": {},
387+
},
388+
room_version=RoomVersions.V9,
389+
)
390+
347391

348392
class SerializeEventTestCase(unittest.TestCase):
349393
def serialize(self, ev, fields):

0 commit comments

Comments
 (0)