Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for unbinding third-party IDs when they are removed from the user account #3

Merged
merged 7 commits into from
Mar 15, 2023

Conversation

anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Feb 14, 2023

This is intended to be used with the on_add_user_third_party_identifier and on_remove_user_third_party_identifier module API callbacks added in matrix-org/synapse#15044. That PR also deprecates on_threepid_bind, hence replacing it here.

Recommended to review commit-by-commit. Supercedes #2.

Note: CI is currently completely failing due to this PR requiring Synapse v1.79 (which is yet to be released). But it passes locally :)

Current status: I would like a review on this PR, but we can't merge it until Synapse v1.79 is released with the Module APIs that it requires.

@anoadragon453 anoadragon453 requested a review from a team as a code owner February 14, 2023 19:11
Switch off the deprecated on_threepid_bind module callback method.
This method will watch for third-party identifiers being
removed from a user's account on Synapse, and subsequently
unbind them from the configured Sydent instance.

We no longer need to inform the homeserver of the binding, as the module
will be able to perform the unbinding now.

Having the homeserver perform the unbind was flawed, as homeservers will
only attempt to talk to identity servers over HTTPS,
whereas this module supports Sydent instances available only over HTTP as well.

The only drawback from this change is that the bind will no longer be removed
if this module is uninstalled. But that doesn't seem particularly unexpected.
Synapse v1.79 is the first version to include the required module API callbacks
for adding and removing third-party IDs from local Matrix user accounts, which
this module makes use of.
@anoadragon453 anoadragon453 added the Z-Time-Tracked Element employees should track their time spent on this issue/PR. label Feb 28, 2023
Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obviously it's a bit lacking in reliability in that there's no retry mechanism etc, but that is probably fine most of the time and fine for a start.

@anoadragon453
Copy link
Member Author

obviously it's a bit lacking in reliability in that there's no retry mechanism etc, but that is probably fine most of the time and fine for a start.

Yeahhhh, I was cribbing off the other method's choice of:

# If there was an error, the IS is likely unreachable, so don't try again.

but we ought to revisit that in an issue - I can imagine there's probably cases where the IS is just overloaded and times out, and we should probably back off and retry a few times.

Additionally, since this method will block Synapse returning requests to the client while it runs, it would be nice to kick off the request to the IS asynchronously and not block Synapse.

...looks like I have some issues to write up.

@reivilibre
Copy link
Contributor

That's fine, I was thinking more persistent retries to be honest, e.g. if the IS really is down, but (depending on use case) it'd probably be nice if it still sorted itself out eventually. But adding storage to the module sounds like a big chunk of work

@anoadragon453
Copy link
Member Author

Providing storage is actually pretty simple, as Synapse provides DB a run_db_interaction method to modules!

I've created a couple relevant issues:

@anoadragon453
Copy link
Member Author

anoadragon453 commented Mar 10, 2023

I temporarily modified the CI config in 94b260d in order to test against the upcoming Synapse v1.79 release. CI passed on that commit, hence this PR should continue to pass CI (and can be merged) once Synapse v1.79 is released (due Tuesday, March 14 2023).

@anoadragon453
Copy link
Member Author

Synapse v1.79.0 has been released, and CI on this PR now passes. We're good to merge.

@anoadragon453 anoadragon453 merged commit 9158b32 into main Mar 15, 2023
@anoadragon453 anoadragon453 deleted the anoa/unbind_support branch March 15, 2023 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-Time-Tracked Element employees should track their time spent on this issue/PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants