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

Implement MSC1915 - 3PID unbind APIs #4982

Merged
merged 9 commits into from Apr 3, 2019

Conversation

Projects
None yet
2 participants
@erikjohnston
Copy link
Member

commented Apr 1, 2019

The commits should make sense by themselves, but the thrust of this PR is that we now keep track of which IS a given 3PID is bound via so we can use that when we come to unbind.

Fixes #4962

@erikjohnston erikjohnston requested a review from matrix-org/synapse-core Apr 1, 2019

@codecov

This comment has been minimized.

Copy link

commented Apr 1, 2019

Codecov Report

Merging #4982 into develop will decrease coverage by 0.04%.
The diff coverage is 39.39%.

@@             Coverage Diff             @@
##           develop    #4982      +/-   ##
===========================================
- Coverage     60.6%   60.55%   -0.05%     
===========================================
  Files          332      331       -1     
  Lines        34235    34239       +4     
  Branches      5655     5659       +4     
===========================================
- Hits         20749    20735      -14     
- Misses       12011    12028      +17     
- Partials      1475     1476       +1
@erikjohnston

This comment has been minimized.

Copy link
Member Author

commented Apr 1, 2019

(Sytests are on their way)

@erikjohnston erikjohnston removed the request for review from matrix-org/synapse-core Apr 1, 2019

@erikjohnston

This comment has been minimized.

Copy link
Member Author

commented Apr 1, 2019

(Sytest has revealed some issues)

erikjohnston added some commits Apr 1, 2019

Track IS used to bind 3PIDs
This will then be used to know which IS to default to when unbinding the
threepid.
For unbind poke IS used during binding of 3PID
This changes the behaviour from using the server specified trusted
identity server to using the IS that used during the binding of the
3PID, if known.

This is the behaviour specified by MSC1915.
Allowing specifying IS to use in unbind API.
By default the homeserver will use the identity server used during the
binding of the 3PID to unbind the 3PID. However, we need to allow
clients to explicitly ask the homeserver to unbind via a particular
identity server, for the case where the 3PID was bound out of band from
the homeserver.

Implements MSC915.
Grandfather in existing user threepids
We assume, as we did before, that users bound their threepid to one of
the trusted identity servers. So we simply fill the new table with all
threepids in `user_threepids` joined with the trusted identity servers.

@erikjohnston erikjohnston force-pushed the erikj/msc1915 branch from e6ab96d to 39fb971 Apr 1, 2019

@erikjohnston erikjohnston requested a review from matrix-org/synapse-core Apr 1, 2019

@erikjohnston

This comment has been minimized.

Copy link
Member Author

commented Apr 1, 2019

Now with tests: matrix-org/sytest#595

@richvdh
Copy link
Member

left a comment

A few nits. Can you also check the copyright declarations on the files you're making significant changes to?

Show resolved Hide resolved synapse/storage/schema/delta/53/user_threepid_id.sql Outdated
Show resolved Hide resolved synapse/storage/schema/delta/53/user_threepid_id.sql Outdated
Show resolved Hide resolved synapse/storage/registration.py Outdated
Show resolved Hide resolved synapse/handlers/identity.py Outdated
Show resolved Hide resolved synapse/handlers/identity.py
Show resolved Hide resolved synapse/handlers/deactivate_account.py
medium=threepid["medium"],
address=threepid["address"],
)
if threepid.get("id_server"):

This comment has been minimized.

Copy link
@richvdh

richvdh Apr 2, 2019

Member

why is this in the dict rather than a function param? (and anyway, the docstring needs updating)

This comment has been minimized.

Copy link
@erikjohnston

erikjohnston Apr 2, 2019

Author Member

Broadly because this is how its handled in the bind path where the threepid dict contains the identity server. I don't mind pulling it out but then we probably want to also pull out medium and address

this.
We do this by grandfathering in existing user threepids assuming that
they used one of the server configured trusted identity servers.

This comment has been minimized.

Copy link
@richvdh

richvdh Apr 2, 2019

Member

one of, or all of? (surely it should be one of, but the code does all of)

This comment has been minimized.

Copy link
@erikjohnston

erikjohnston Apr 2, 2019

Author Member

We assume that they used "one of", but we don't know which one so we have to include all the id servers.

@erikjohnston erikjohnston force-pushed the erikj/msc1915 branch from b8635c9 to 4ef5d17 Apr 2, 2019

@erikjohnston erikjohnston requested a review from richvdh Apr 2, 2019

@richvdh

richvdh approved these changes Apr 2, 2019

Copy link
Member

left a comment

lgtm

@erikjohnston erikjohnston merged commit 8f549c1 into develop Apr 3, 2019

24 checks passed

buildkite/synapse Build #736 passed (14 minutes, 1 second)
Details
buildkite/synapse/check-sample-config Passed (1 minute, 5 seconds)
Details
buildkite/synapse/isort Passed (40 seconds)
Details
buildkite/synapse/newspaper-newsfile Passed (23 seconds)
Details
buildkite/synapse/packaging Passed (34 seconds)
Details
buildkite/synapse/pep-8 Passed (52 seconds)
Details
buildkite/synapse/pipeline Passed (2 seconds)
Details
buildkite/synapse/python-2-dot-7-slash-postgres-9-dot-4 Passed (11 minutes, 16 seconds)
Details
buildkite/synapse/python-2-dot-7-slash-postgres-9-dot-5 Passed (11 minutes, 41 seconds)
Details
buildkite/synapse/python-2-dot-7-slash-sqlite Passed (5 minutes, 51 seconds)
Details
buildkite/synapse/python-2-dot-7-slash-sqlite-slash-old-deps Passed (7 minutes, 58 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-postgres-9-dot-4 Passed (11 minutes, 56 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-postgres-9-dot-5 Passed (12 minutes, 38 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-sqlite Passed (8 minutes, 19 seconds)
Details
buildkite/synapse/python-3-dot-6-slash-sqlite Passed (7 minutes, 25 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-postgres-11 Passed (12 minutes, 31 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-postgres-9-dot-5 Passed (12 minutes, 26 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-sqlite Passed (6 minutes, 40 seconds)
Details
ci/circleci: sytestpy2merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2postgresmerged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3postgresmerged Your tests passed on CircleCI!
Details
codecov/patch 39.39% of diff hit (target 0%)
Details
codecov/project 60.55% (target 0%)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.