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

Commit e65faf5

Browse files
committed
Merge branch 'anoa/reg_email' into anoa/reg_email_account_threepid_delegate
* anoa/reg_email: Remove trusted_third_party_id_servers functionality (#5875)
2 parents cfe7309 + 8a3175f commit e65faf5

File tree

5 files changed

+22
-27
lines changed

5 files changed

+22
-27
lines changed

changelog.d/5875.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deprecate the `trusted_third_party_id_servers` option.

contrib/cmdclient/console.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
CONFIG_JSON = "cmdclient_config.json"
3939

40+
# TODO: The concept of trusted identity servers has been deprecated. This option and checks
41+
# should be removed
4042
TRUSTED_ID_SERVERS = ["localhost:8001"]
4143

4244

docs/sample_config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,14 @@ uploads_path: "DATADIR/uploads"
890890
# Also defines the ID server which will be called when an account is
891891
# deactivated (one will be picked arbitrarily).
892892
#
893+
# Note: This option is deprecated. Since v0.99.4, Synapse has tracked which identity
894+
# server a 3PID has been bound to. For 3PIDs bound before then, Synapse runs a
895+
# background migration script, informing itself that the identity server all of its
896+
# 3PIDs have been bound to is likely one of the below.
897+
#
898+
# As of Synapse v1.4.0, all other functionality of this option has been deprecated, and
899+
# it is now solely used for the purposes of the background migration script, and can be
900+
# removed once it has run.
893901
#trusted_third_party_id_servers:
894902
# - matrix.org
895903
# - vector.im

synapse/config/registration.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@ def generate_config_section(self, generate_secrets=False, **kwargs):
258258
# Also defines the ID server which will be called when an account is
259259
# deactivated (one will be picked arbitrarily).
260260
#
261+
# Note: This option is deprecated. Since v0.99.4, Synapse has tracked which identity
262+
# server a 3PID has been bound to. For 3PIDs bound before then, Synapse runs a
263+
# background migration script, informing itself that the identity server all of its
264+
# 3PIDs have been bound to is likely one of the below.
265+
#
266+
# As of Synapse v1.4.0, all other functionality of this option has been deprecated, and
267+
# it is now solely used for the purposes of the background migration script, and can be
268+
# removed once it has run.
261269
#trusted_third_party_id_servers:
262270
# - matrix.org
263271
# - vector.im

synapse/handlers/identity.py

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,6 @@ def __init__(self, hs):
3737
self.http_client = hs.get_simple_http_client()
3838
self.federation_http_client = hs.get_http_client()
3939

40-
self.trusted_id_servers = set(hs.config.trusted_third_party_id_servers)
41-
self.trust_any_id_server_just_for_testing_do_not_use = (
42-
hs.config.use_insecure_ssl_client_just_for_testing_do_not_use
43-
)
44-
45-
def _should_trust_id_server(self, id_server):
46-
if id_server not in self.trusted_id_servers:
47-
if self.trust_any_id_server_just_for_testing_do_not_use:
48-
logger.warn(
49-
"Trusting untrustworthy ID server %r even though it isn't"
50-
" in the trusted id list for testing because"
51-
" 'use_insecure_ssl_client_just_for_testing_do_not_use'"
52-
" is set in the config",
53-
id_server,
54-
)
55-
else:
56-
return False
57-
return True
58-
5940
@defer.inlineCallbacks
6041
def threepid_from_creds(self, creds):
6142
if "id_server" in creds:
@@ -72,13 +53,6 @@ def threepid_from_creds(self, creds):
7253
else:
7354
raise SynapseError(400, "No client_secret in creds")
7455

75-
if not self._should_trust_id_server(id_server):
76-
logger.warn(
77-
"%s is not a trusted ID server: rejecting 3pid " + "credentials",
78-
id_server,
79-
)
80-
return None
81-
8256
try:
8357
data = yield self.http_client.get_json(
8458
"https://%s%s"
@@ -222,7 +196,9 @@ def try_unbind_threepid_with_id_server(self, mxid, threepid, id_server):
222196
return changed
223197

224198
@defer.inlineCallbacks
225-
def requestEmailToken(self, email, client_secret, send_attempt, next_link=None, **kwargs):
199+
def requestEmailToken(
200+
self, email, client_secret, send_attempt, next_link=None, **kwargs
201+
):
226202
"""
227203
Request an external server send an email on our behalf for the purposes of threepid
228204
validation.

0 commit comments

Comments
 (0)