-
Notifications
You must be signed in to change notification settings - Fork 748
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
UIAA for register is wrong (needs MSC) #1924
Comments
Signup flow on Element Android is documented here. Is there something wrong in the documentation, or do you think the current implementation is not conform to the documentation? FWIW, we have no problem when creating on account on Synapse, which I admit does not guarantee that there is no bug though. |
The spec has required fields in /register, but the 'First step' request body is empty, so conduit returns 'bad request' and makes element android say the server does not allow registration |
I do not see any required fields for the Also I do not see the link between your last comment and the issue description. |
Okay, ignore my last comment, what's important is this:
Conduit responds with the uiaa info containing a
Conduit responds with "Forbidden" because it assumes the request contains all the fields from the first request |
Element Web does this:
(It seems to not care about the uiaa token of the response, so maybe it does this to check if registration is enabled?)
|
Ok, I got it. In your case, even for Element-Web, the So I think UIAA for registration is a bit particular regarding the documentation https://matrix.org/docs/spec/client_server/r0.6.1#user-interactive-api-in-the-rest-api Do you agree with my point of view? |
Currently UIAA tokens are only valid for the user who created them. That means I need to know the user id to check if a uiaa token is valid, which is not the case for /register without the username field. Secondly, the way conduit endpoints work (using the ruma library to deserialize them) makes sure that required fields are present and otherwise automatically returns "Bad Request" to them. This doesn't work with the way you want UIAA to work and hard to change |
Ok, I will check internally what is the decision to take here, thanks for your patience :). I understand that your homeserver (with ruma) expects mandatory fields and this is good to have request validation server side :). Also, what is you plan to tell the client if registration is enabled or not? As discussed above, Element Android sends an empty body and Element Web sends only the |
FTR I also see in one unit test from Synapse that the above mentioned fields are not always sent, which confirm that this request is well valid for Synapse. |
I'm afraid Sytest does indeed test whether requests are valid for Synapse - but this may not translate to being valid as defined by the spec :) @timokoesters is arguing the spec states that in order for a client to choose and complete its first chosen stage, "A client should first make a request with no auth parameter. ... The client then chooses a flow and attempts to complete the first stage. It does this by resubmitting the same request with the addition of an auth key in the object that it submits" (emphasis mine). From the examples @timokoesters posted, it looks like Element Android is trying to complete a stage without including the keys from the previous request, which is technically against the spec. I believe the intention of sending the keys each time is so that the server has less book-keeping to deal with. Synapse, being lax from the beginning, did not want to break old clients, and thus indeed stores all information about a register request as it learns it (however is careful to store passwords hashed). Fundamentally this is an instance of the spec being a bit vague. For instance, technically Element Android doesn't have to send the initial keys during its attempt at completing a second stage, as the spec only explicitly requires it being necessary for the first - even though this doesn't make any logical sense. I'm rather happy to see new server/client implementations following the spec to the letter and learning the pitfalls of the current iteration. As the spec currently stands @timokoesters is right and Element Android should resend the keys. If that's not possible or extremely difficult for Element Android to do, then we can make a bid to update the spec, although it should certainly be updated regardless to help settle misinterpretation in this area. I believe it's fine if older versions of Element Android won't work here. |
The UI auth unit tests are more interesting here then the initially given one. There are also two interesting sytests:
I believe that according to the specification clients are supposed to provide the non-auth parameters on each request, but Synapse has backwards compatibility features to allow clients to not do this. The relevant logic in Synapse, that code has been modified recently, but I can't say that the ideas behind the comments are all still valid or not. I do think the spec needs to be clarified here and made explicit one way or the other. |
(Update: the above is child's blabber and doesn't help the discussion.) |
Maybe the problem here is that |
It isn't about submitting past stage's data, it is about the data necessary for the endpoint to be processed once auth is complete. So anything that is not in the |
FTR Dendrite current implementation has the same problem than Conduit: we cannot create account with Element Android |
It would be great to fix this soon or even just temporarily edit the error message to say something like "registration only works with Synapse servers right now". Today someone was trying to setup a Dendrite server and spent hours trying to reconfigure it because they thought their server was broken but it was just this bug. |
I made Conduit's UIAA implementation work like synapse's: I think we can close this issue when an MSC for this behavior is accepted |
Registering on Conduit fails. I looked at the request jsons and it looks like it sends a /register request with just
auth
andsession
keys. The spec says a client should retry the original request PLUS auth and session.https://matrix.org/docs/spec/client_server/r0.6.1#user-interactive-api-in-the-rest-api
The text was updated successfully, but these errors were encountered: