-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Trying to set a password during UI Auth while also failing to authenticate during a stage will result in the password not being saved #9263
Comments
This was causing a LoginError to be propagated up to the registration servlet, which was expecting a InteractiveAuthIncompleteError in order to store a password_hash from the client for the session. DINUM relies on this happening. More info here: matrix-org/synapse#9263
Alright, so just catching synapse/synapse/rest/client/v2_alpha/register.py Lines 531 to 535 in 789d9eb
Instead, I realised that a synapse/synapse/handlers/auth.py Lines 569 to 578 in 02070c6
If we just remove that conditional, ...I assume it's not controversial to remove that at this point? The issue was fixed in Riot 0.7.4 (released Oct 12, 2016). |
The solution of removing the tech-debt indeed solved the issue for DINUM, and the one I recommend we go for. Commit: matrix-org/synapse-dinsic@d36bfdd |
I haven't fully looked at the code again but I think the issue is that they should provide the password in the first step instead of a "get auth session step". |
So I think the changes in #9265, but I think the client is still doing something unexpected here (and will essentially end up with a second session?). |
@clokep The session ID from the first "dummy" request is re-used in subsequent requests, and thus they'll only ever have one session. But you're right in that if the password were provided in the first request then it would be saved and the registration would succeed. Patching in the server in addition to the client is preferable for DINUM however, so that every client does not need to be updated immediately.. |
Context, Fixes: #9263 In the past to fix an issue with old Riots re-requesting threepid validation tokens, we raised a `LoginError` during UIA instead of `InteractiveAuthIncompleteError`. This is now breaking the way Tchap logs in - which isn't standard, but also isn't disallowed by the spec. An easy fix is just to remove the 4 year old workaround.
Related: https://github.com/matrix-org/matrix-doc/issues/2907, #8009
CC: @clokep
DINUM were finding after upgrading to Synapse v1.23.0 that email registration was no longer working due to "Missing params: password". Their flow consisted of the following requests.
Check with the homeserver what the required flows to register are:
Request a validation token from Synapse (no Sydent involved here):
Request /register again, this time with a password which we want to save. We're doing to do a
m.login.email.identity
here even though we know that it's going to fail. Note thatm.login.email.identity
is the only flow the server gives us. We just want to save the password.The client got a 401 one, but not from a
InteractiveAuthIncompleteError
exception, but aLoginError
coming from here:synapse/synapse/handlers/ui_auth/checkers.py
Lines 191 to 192 in c9c0ad5
Now unfortunately, the code that stores
password_hash
inui_auth_sessions
for subsequent UI Auth requests will only do so if aInteractiveAuthIncompleteError
is raised, notLoginError
:synapse/synapse/rest/client/v2_alpha/register.py
Lines 513 to 536 in 789d9eb
So uh oh. A
password_hash
never got saved. In the case of DINUM, a user now clicks the link in their email and is brought to a completely separate client which doesn't know what the password is supposed to be.That client (having validated the threepid) then makes a final request to
/register
:And thus registration fails.
I think a simple solution here would be to catch
LoginError
in addition toInteractiveAuthIncompleteError
where we store the pasword_hash:synapse/synapse/rest/client/v2_alpha/register.py
Lines 513 to 536 in 789d9eb
That way the client would still get the same exact error, but now we're storing the hash when a
LoginError
is raised. If we go with this, we should also do it in/account/password
, which does the same:synapse/synapse/rest/client/v2_alpha/account.py
Line 196 in 7a2e9b5
Additionally, the client could just send the password without attempting to complete an auth step, though this isn't really clear from the perspective of the client developer.
The text was updated successfully, but these errors were encountered: