-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Remove email addresses / phone numbers from ID servers when they're removed from synapse #3276
Conversation
synapse/handlers/auth.py
Outdated
@@ -825,6 +825,15 @@ def delete_threepid(self, user_id, medium, address): | |||
if medium == 'email': | |||
address = address.lower() | |||
|
|||
identity_handler = self.hs.get_handlers().identity_handler | |||
identity_handler.unbind_threepid( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a yield
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
yield self.store.user_delete_threepid( | ||
user_id, threepid['medium'], threepid['address'], | ||
) | ||
|
||
# first delete any devices belonging to the user, which will also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/first//
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
synapse/handlers/identity.py
Outdated
@@ -138,6 +140,44 @@ def bind_threepid(self, creds, mxid): | |||
data = json.loads(e.msg) | |||
defer.returnValue(data) | |||
|
|||
@defer.inlineCallbacks | |||
def unbind_threepid(self, mxid, threepid): | |||
yield run_on_reactor() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargoculting probably. removed.
@@ -138,6 +140,44 @@ def bind_threepid(self, creds, mxid): | |||
data = json.loads(e.msg) | |||
defer.returnValue(data) | |||
|
|||
@defer.inlineCallbacks | |||
def unbind_threepid(self, mxid, threepid): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can haz docstring pls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -264,14 +264,19 @@ def _request(self, destination, method, path, | |||
defer.returnValue(response) | |||
|
|||
def sign_request(self, destination, method, url_bytes, headers_dict, | |||
content=None): | |||
content=None, destination_is=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can haz doc for new param pls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
synapse/handlers/identity.py
Outdated
threepid (dict): Dict with medium & address of binding to be removed | ||
|
||
Returns: | ||
Deferred |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deferred what?
Deferred[bool]
I guess, but what does the bool mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
destination_is (str): As 'destination', but if the destination is an identity server | ||
|
||
Returns: | ||
Deferred |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
""" | ||
Signs a request by adding an Authorization header to headers_dict | ||
Args: | ||
destination (str): The desination home server of the request. May be null if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/null/None/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
""" | ||
Signs a request by adding an Authorization header to headers_dict | ||
Args: | ||
destination (str): The desination home server of the request. May be null if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are all meant to be bytes
rather than str
fwiw. Especially url_bytes
which you are carefully .encode
ing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point
destination (str): The desination home server of the request. May be null if the | ||
destination is an identity server, in which case destination_is must be non-null. | ||
method (str): The HTTP method of the request | ||
url_bytes (str): ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the uri path of the request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
request["destination"] = destination | ||
|
||
if destination_is is not None: | ||
request["destination_is"] = destination_is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so what is the logic behind putting this in a different field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make sure it's always distinct from a request to a homeserver with the same name, eg. that you could reuse the same signature for a request to the matrix.org HS to sign the same request to the matrix.org IS as they're different destinations (although in practice are unlikely to support the same request).
also your pep8 is bad |
ptal! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm apart from doc nits
url_bytes (str): ? | ||
destination (bytes): The desination home server of the request. May be None | ||
if the destination is an identity server, in which case destination_is | ||
must be non-null. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/null/None/
destination is an identity server, in which case destination_is must be non-null. | ||
method (str): The HTTP method of the request | ||
url_bytes (str): ? | ||
destination (bytes): The desination home server of the request. May be None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bytes|None
content (str): The body of the request | ||
destination_is (str): As 'destination', but if the destination is an identity server | ||
content (bytes): The body of the request | ||
destination_is (bytes): As 'destination', but if the destination is an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bytes|None
could you try to update the PR summary to something which will make more sense when it lands in the changelog? |
On account deactivation and 3pid deletion.
Implements unbind API as per spec proposal: matrix-org/matrix-spec-proposals#1194
Related sydent PR: matrix-org/sydent#67