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

Commit 763dba7

Browse files
committed
Merge tag 'v1.37.0rc1' into develop
Synapse 1.37.0rc1 (2021-06-24) ============================== This release deprecates the current spam checker interface. See the [upgrade notes](https://matrix-org.github.io/synapse/develop/upgrade#deprecation-of-the-current-spam-checker-interface) for more information on how to update to the new generic module interface. This release also removes support for fetching and renewing TLS certificates using the ACME v1 protocol, which has been fully decommissioned by Let's Encrypt on June 1st 2021. Admins previously using this feature should use a [reverse proxy](https://matrix-org.github.io/synapse/develop/reverse_proxy.html) to handle TLS termination, or use an external ACME client (such as [certbot](https://certbot.eff.org/)) to retrieve a certificate and key and provide them to Synapse using the `tls_certificate_path` and `tls_private_key_path` configuration settings. Features -------- - Implement "room knocking" as per [MSC2403](matrix-org/matrix-spec-proposals#2403). Contributed by @Sorunome and anoa. ([\#6739](#6739), [\#9359](#9359), [\#10167](#10167), [\#10212](#10212), [\#10227](#10227)) - Add experimental support for backfilling history into rooms ([MSC2716](matrix-org/matrix-spec-proposals#2716)). ([\#9247](#9247)) - Implement a generic interface for third-party plugin modules. ([\#10062](#10062), [\#10206](#10206)) - Implement config option `sso.update_profile_information` to sync SSO users' profile information with the identity provider each time they login. Currently only displayname is supported. ([\#10108](#10108)) - Ensure that errors during startup are written to the logs and the console. ([\#10191](#10191)) Bugfixes -------- - Fix a bug introduced in Synapse v1.25.0 that prevented the `ip_range_whitelist` configuration option from working for federation and identity servers. Contributed by @mikure. ([\#10115](#10115)) - Remove a broken import line in Synapse's `admin_cmd` worker. Broke in Synapse v1.33.0. ([\#10154](#10154)) - Fix a bug introduced in Synapse v1.21.0 which could cause `/sync` to return immediately with an empty response. ([\#10157](#10157), [\#10158](#10158)) - Fix a minor bug in the response to `/_matrix/client/r0/user/{user}/openid/request_token` causing `expires_in` to be a float instead of an integer. Contributed by @lukaslihotzki. ([\#10175](#10175)) - Always require users to re-authenticate for dangerous operations: deactivating an account, modifying an account password, and adding 3PIDs. ([\#10184](#10184)) - Fix a bug introduced in Synpase v1.7.2 where remote server count metrics collection would be incorrectly delayed on startup. Found by @heftig. ([\#10195](#10195)) - Fix a bug introduced in Synapse v1.35.1 where an `allow` key of a `m.room.join_rules` event could be applied for incorrect room versions and configurations. ([\#10208](#10208)) - Fix performance regression in responding to user key requests over federation. Introduced in Synapse v1.34.0rc1. ([\#10221](#10221)) Improved Documentation ---------------------- - Add a new guide to decoding request logs. ([\#8436](#8436)) - Mention in the sample homeserver config that you may need to configure max upload size in your reverse proxy. Contributed by @aaronraimist. ([\#10122](#10122)) - Fix broken links in documentation. ([\#10180](#10180)) - Deploy a snapshot of the documentation website upon each new Synapse release. ([\#10198](#10198)) Deprecations and Removals ------------------------- - The current spam checker interface is deprecated in favour of a new generic modules system. See the [upgrade notes](https://matrix-org.github.io/synapse/develop/upgrade#deprecation-of-the-current-spam-checker-interface) for more information on how to update to the new system. ([\#10062](#10062), [\#10210](#10210), [\#10238](#10238)) - Stop supporting the unstable spaces prefixes from MSC1772. ([\#10161](#10161)) - Remove Synapse's support for automatically fetching and renewing certificates using the ACME v1 protocol. This protocol has been fully turned off by Let's Encrypt for existing installations on June 1st 2021. Admins previously using this feature should use a [reverse proxy](https://matrix-org.github.io/synapse/develop/reverse_proxy.html) to handle TLS termination, or use an external ACME client (such as [certbot](https://certbot.eff.org/)) to retrieve a certificate and key and provide them to Synapse using the `tls_certificate_path` and `tls_private_key_path` configuration settings. ([\#10194](#10194)) Internal Changes ---------------- - Update the database schema versioning to support gradual migration away from legacy tables. ([\#9933](#9933)) - Add type hints to the federation servlets. ([\#10080](#10080)) - Improve OpenTracing for event persistence. ([\#10134](#10134), [\#10193](#10193)) - Clean up the interface for injecting OpenTracing over HTTP. ([\#10143](#10143)) - Limit the number of in-flight `/keys/query` requests from a single device. ([\#10144](#10144)) - Refactor EventPersistenceQueue. ([\#10145](#10145)) - Document `SYNAPSE_TEST_LOG_LEVEL` to see the logger output when running tests. ([\#10148](#10148)) - Update the Complement build tags in GitHub Actions to test currently experimental features. ([\#10155](#10155)) - Add a `synapse_federation_soft_failed_events_total` metric to track how often events are soft failed. ([\#10156](#10156)) - Fetch the corresponding complement branch when performing CI. ([\#10160](#10160)) - Add some developer documentation about boolean columns in database schemas. ([\#10164](#10164)) - Add extra logging fields to better debug where events are being soft failed. ([\#10168](#10168)) - Add debug logging for when we enter and exit `Measure` blocks. ([\#10183](#10183)) - Improve comments in structured logging code. ([\#10188](#10188)) - Update [MSC3083](matrix-org/matrix-spec-proposals#3083) support with modifications from the MSC. ([\#10189](#10189)) - Remove redundant DNS lookup limiter. ([\#10190](#10190)) - Upgrade `black` linting tool to 21.6b0. ([\#10197](#10197)) - Expose OpenTracing trace id in response headers. ([\#10199](#10199))
2 parents 7f25d73 + bb472f3 commit 763dba7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+155
-53
lines changed

Diff for: CHANGES.md

+71

Diff for: changelog.d/10062.feature

-1
This file was deleted.

Diff for: changelog.d/10062.removal

-1
This file was deleted.

Diff for: changelog.d/10080.misc

-1
This file was deleted.

Diff for: changelog.d/10108.feature

-1
This file was deleted.

Diff for: changelog.d/10115.bugfix

-1
This file was deleted.

Diff for: changelog.d/10122.doc

-1
This file was deleted.

Diff for: changelog.d/10134.misc

-1
This file was deleted.

Diff for: changelog.d/10143.misc

-1
This file was deleted.

Diff for: changelog.d/10144.misc

-1
This file was deleted.

Diff for: changelog.d/10145.misc

-1
This file was deleted.

Diff for: changelog.d/10148.misc

-1
This file was deleted.

Diff for: changelog.d/10154.bugfix

-1
This file was deleted.

Diff for: changelog.d/10155.misc

-1
This file was deleted.

Diff for: changelog.d/10156.misc

-1
This file was deleted.

Diff for: changelog.d/10157.bugfix

-1
This file was deleted.

Diff for: changelog.d/10158.bugfix

-1
This file was deleted.

Diff for: changelog.d/10160.misc

-1
This file was deleted.

Diff for: changelog.d/10161.removal

-1
This file was deleted.

Diff for: changelog.d/10164.misc

-1
This file was deleted.

Diff for: changelog.d/10167.feature

-1
This file was deleted.

Diff for: changelog.d/10168.misc

-1
This file was deleted.

Diff for: changelog.d/10175.bugfix

-1
This file was deleted.

Diff for: changelog.d/10180.doc

-1
This file was deleted.

Diff for: changelog.d/10183.misc

-1
This file was deleted.

Diff for: changelog.d/10184.bugfix

-1
This file was deleted.

Diff for: changelog.d/10188.misc

-1
This file was deleted.

Diff for: changelog.d/10189.misc

-1
This file was deleted.

Diff for: changelog.d/10190.misc

-1
This file was deleted.

Diff for: changelog.d/10191.feature

-1
This file was deleted.

Diff for: changelog.d/10193.misc

-1
This file was deleted.

Diff for: changelog.d/10194.removal

-1
This file was deleted.

Diff for: changelog.d/10195.bugfix

-1
This file was deleted.

Diff for: changelog.d/10197.misc

-1
This file was deleted.

Diff for: changelog.d/10198.doc

-1
This file was deleted.

Diff for: changelog.d/10199.misc

-1
This file was deleted.

Diff for: changelog.d/10206.feature

-1
This file was deleted.

Diff for: changelog.d/10208.bugfix

-1
This file was deleted.

Diff for: changelog.d/10210.removal

-1
This file was deleted.

Diff for: changelog.d/10212.feature

-1
This file was deleted.

Diff for: changelog.d/10221.bugfix

-1
This file was deleted.

Diff for: changelog.d/10227.feature

-1
This file was deleted.

Diff for: changelog.d/6739.feature

-1
This file was deleted.

Diff for: changelog.d/8436.doc

-1
This file was deleted.

Diff for: changelog.d/9247.feature

-1
This file was deleted.

Diff for: changelog.d/9359.feature

-1
This file was deleted.

Diff for: changelog.d/9933.misc

-1
This file was deleted.

Diff for: synapse/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
except ImportError:
4848
pass
4949

50-
__version__ = "1.36.0"
50+
__version__ = "1.37.0rc1"
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

Diff for: synapse/events/spamcheck.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def async_wrapper(f: Optional[Callable]) -> Optional[Callable[..., Awaitable]]:
109109
if f is None:
110110
return None
111111

112+
wrapped_func = f
113+
112114
if f.__name__ == "check_registration_for_spam":
113115
checker_args = inspect.signature(f)
114116
if len(checker_args.parameters) == 3:
@@ -133,19 +135,18 @@ def wrapper(
133135
request_info,
134136
)
135137

136-
f = wrapper
138+
wrapped_func = wrapper
137139
elif len(checker_args.parameters) != 4:
138140
raise RuntimeError(
139141
"Bad signature for callback check_registration_for_spam",
140142
)
141143

142144
def run(*args, **kwargs):
143-
# We've already made sure f is not None above, but mypy doesn't do well
144-
# across function boundaries so we need to tell it f is definitely not
145-
# None.
146-
assert f is not None
145+
# mypy doesn't do well across function boundaries so we need to tell it
146+
# wrapped_func is definitely not None.
147+
assert wrapped_func is not None
147148

148-
return maybe_awaitable(f(*args, **kwargs))
149+
return maybe_awaitable(wrapped_func(*args, **kwargs))
149150

150151
return run
151152

Diff for: tests/handlers/test_register.py

+76
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from synapse.api.auth import Auth
1818
from synapse.api.constants import UserTypes
1919
from synapse.api.errors import Codes, ResourceLimitError, SynapseError
20+
from synapse.events.spamcheck import load_legacy_spam_checkers
2021
from synapse.spam_checker_api import RegistrationBehaviour
2122
from synapse.types import RoomAlias, RoomID, UserID, create_requester
2223

@@ -79,6 +80,39 @@ async def check_registration_for_spam(
7980
return RegistrationBehaviour.ALLOW
8081

8182

83+
class TestLegacyRegistrationSpamChecker:
84+
def __init__(self, config, api):
85+
pass
86+
87+
async def check_registration_for_spam(
88+
self,
89+
email_threepid,
90+
username,
91+
request_info,
92+
):
93+
pass
94+
95+
96+
class LegacyAllowAll(TestLegacyRegistrationSpamChecker):
97+
async def check_registration_for_spam(
98+
self,
99+
email_threepid,
100+
username,
101+
request_info,
102+
):
103+
return RegistrationBehaviour.ALLOW
104+
105+
106+
class LegacyDenyAll(TestLegacyRegistrationSpamChecker):
107+
async def check_registration_for_spam(
108+
self,
109+
email_threepid,
110+
username,
111+
request_info,
112+
):
113+
return RegistrationBehaviour.DENY
114+
115+
82116
class RegistrationTestCase(unittest.HomeserverTestCase):
83117
"""Tests the RegistrationHandler."""
84118

@@ -95,6 +129,8 @@ def make_homeserver(self, reactor, clock):
95129

96130
hs = self.setup_test_homeserver(config=hs_config)
97131

132+
load_legacy_spam_checkers(hs)
133+
98134
module_api = hs.get_module_api()
99135
for module, config in hs.config.modules.loaded_modules:
100136
module(config=config, api=module_api)
@@ -535,6 +571,46 @@ def test_spam_checker_deny(self):
535571
"""A spam checker can deny registration, which results in an error."""
536572
self.get_failure(self.handler.register_user(localpart="user"), SynapseError)
537573

574+
@override_config(
575+
{
576+
"spam_checker": [
577+
{
578+
"module": TestSpamChecker.__module__ + ".LegacyAllowAll",
579+
}
580+
]
581+
}
582+
)
583+
def test_spam_checker_legacy_allow(self):
584+
"""Tests that a legacy spam checker implementing the legacy 3-arg version of the
585+
check_registration_for_spam callback is correctly called.
586+
587+
In this test and the following one we test both success and failure to make sure
588+
any failure comes from the spam checker (and not something else failing in the
589+
call stack) and any success comes from the spam checker (and not because a
590+
misconfiguration prevented it from being loaded).
591+
"""
592+
self.get_success(self.handler.register_user(localpart="user"))
593+
594+
@override_config(
595+
{
596+
"spam_checker": [
597+
{
598+
"module": TestSpamChecker.__module__ + ".LegacyDenyAll",
599+
}
600+
]
601+
}
602+
)
603+
def test_spam_checker_legacy_deny(self):
604+
"""Tests that a legacy spam checker implementing the legacy 3-arg version of the
605+
check_registration_for_spam callback is correctly called.
606+
607+
In this test and the previous one we test both success and failure to make sure
608+
any failure comes from the spam checker (and not something else failing in the
609+
call stack) and any success comes from the spam checker (and not because a
610+
misconfiguration prevented it from being loaded).
611+
"""
612+
self.get_failure(self.handler.register_user(localpart="user"), SynapseError)
613+
538614
@override_config(
539615
{
540616
"modules": [

0 commit comments

Comments
 (0)