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

Remove code invalidated by deprecated config flag 'trust_identity_servers_for_password_resets' #11395

Merged
merged 8 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11395.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove deprecated `trust_identity_server_for_password_resets` configuration flag.
8 changes: 0 additions & 8 deletions docker/conf/homeserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,6 @@ bcrypt_rounds: 12
allow_guest_access: {{ "True" if SYNAPSE_ALLOW_GUEST else "False" }}
enable_group_creation: true

# The list of identity servers trusted to verify third party
# identifiers by this server.
#
# Also defines the ID server which will be called when an account is
# deactivated (one will be picked arbitrarily).
trusted_third_party_id_servers:
- matrix.org
- vector.im

## Metrics ###

Expand Down
35 changes: 3 additions & 32 deletions synapse/storage/databases/main/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1728,11 +1728,11 @@ def __init__(
)

self.db_pool.updates.register_background_update_handler(
"user_threepids_grandfather", self._bg_user_threepids_grandfather
"users_set_deactivated_flag", self._background_update_set_deactivated_flag
)

self.db_pool.updates.register_background_update_handler(
"users_set_deactivated_flag", self._background_update_set_deactivated_flag
self.db_pool.updates.register_noop_background_update(
"user_threepids_grandfather"
)

self.db_pool.updates.register_background_index_update(
Expand Down Expand Up @@ -1805,35 +1805,6 @@ def _background_update_set_deactivated_flag_txn(txn):

return nb_processed

async def _bg_user_threepids_grandfather(self, progress, batch_size):
"""We now track which identity servers a user binds their 3PID to, so
we need to handle the case of existing bindings where we didn't track
this.

We do this by grandfathering in existing user threepids assuming that
they used one of the server configured trusted identity servers.
"""
id_servers = set(self.config.registration.trusted_third_party_id_servers)

def _bg_user_threepids_grandfather_txn(txn):
sql = """
INSERT INTO user_threepid_id_server
(user_id, medium, address, id_server)
SELECT user_id, medium, address, ?
FROM user_threepids
"""

txn.execute_batch(sql, [(id_server,) for id_server in id_servers])

if id_servers:
await self.db_pool.runInteraction(
"_bg_user_threepids_grandfather", _bg_user_threepids_grandfather_txn
)

await self.db_pool.updates._end_background_update("user_threepids_grandfather")

return 1

async def set_user_deactivated_status(
self, user_id: str, deactivated: bool
) -> None:
Expand Down
1 change: 0 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def default_config(name, parse=False):
"enable_registration": True,
"enable_registration_captcha": False,
"macaroon_secret_key": "not even a little secret",
"trusted_third_party_id_servers": [],
"password_providers": [],
"worker_replication_url": "",
"worker_app": None,
Expand Down