element-hq / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://element-hq.github.io/dendrite/
GNU Affero General Public License v3.0
10 stars 3 forks source link

Signing in with uppercase username breaks device list updates #2914

Closed matrixbot closed 2 weeks ago

matrixbot commented 2 weeks ago

This issue was originally created by @nico-famedly at https://github.com/matrix-org/dendrite/issues/2914.

Background information

Description

Steps to reproduce

I would expect device lists to always use the exact mxid instead of the casing from /login.

Logs:

# Normal login using "bob"

Updating device keys for {@bob:famedlysdk.test: []}

Response {@bob:famedlysdk.test: {pnv71Ijt: Instance of 'MatrixDeviceKeys'}}

# Login using "Bob"

[Matrix] Successfully connected as Bob with http://127.0.0.1

Updating device keys for {@Bob:famedlysdk.test: []}

Response {@Bob:famedlysdk.test: {2Cfqnc6M: Instance of 'MatrixDeviceKeys'}}

Notice how the latter does not include the devices form "bob" and uses the wrong mxid in the response.

matrixbot commented 2 weeks ago

This comment was originally posted by @bones-was-here at https://github.com/matrix-org/dendrite/issues/2914#issuecomment-1352408749.

How are you able to log in with an uppercase char?

I still patch the source to support very old accounts https://github.com/matrix-org/dendrite/issues/2073#issuecomment-1047934258

matrixbot commented 2 weeks ago

This comment was originally posted by @deepbluev7 at https://github.com/matrix-org/dendrite/issues/2914#issuecomment-1360685157.

@bones-was-here I just passed "Bob" as the login username and it worked. The actual useraccount in the database is lower case, since it is lowercased on registration and login, but the signed in user is treated as if the localpart was uppercase.