Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Not all username request are being set to lowercase #3263

Closed
raymatos opened this issue Nov 12, 2023 · 5 comments
Closed

Not all username request are being set to lowercase #3263

raymatos opened this issue Nov 12, 2023 · 5 comments

Comments

@raymatos
Copy link

raymatos commented Nov 12, 2023

Background information

Dendrite version 0.13.4+317b101
Postgres
docker

Description

Using the linkedin bridge service, replicated the issue using curl. Looks like userID are set to lowercase before being saved to DB, however it doesnt look like all request to running toLower on all username inputs.

This call does not work

Try to update the displayname 
curl -X PUT 'https://matrix.*DOMAIN*.com/_matrix/client/v3/profile/%40linkedin_TTTT2-3892bvy478cy34by0283y908c4239%3D%3D%3Amatrix.*DOMAIN*.com/displayname?user_id=@linkedin_TTTT2-3892bvy478cy34by0283y908c4239==%3D%3D:matrix.*DOMAIN*.com&access_token=******' \
-H 'Content-Type: application/json' \
-d '{
"displayname": "Slim Shady from LinkedIn (LinkedIn)"
}'
{"Err":""}%

LOG - time="2023-11-12T01:52:33.661187095Z" level=error msg="profileAPI.SetDisplayName failed" func=github.com/matrix-org/dendrite/clientapi/routing.SetDisplayName file="github.com/matrix-org/dendrite/clientapi/routing/profile.go:224" error="sql: no rows in result set" req.id=XYkxZAdQi3fy req.method=PUT req.path="/_matrix/client/v3/profile/@linkedin_TTTT2-3892bvy478cy34by0283y908c4239==:matrix.*DOMAIN*.com/displayname" user_id="@linkedin_TTTT2-3892bvy478cy34by0283y908c4239==:matrix.*DOMAIN*.com"

Same call works in if username in URL is lowercase

Try to update the displayname 
curl -X PUT 'https://matrix.*DOMAIN*.com/_matrix/client/v3/profile/%40linkedin_tttt2-3892bvy478cy34by0283y908c4239%3D%3D%3Amatrix.*DOMAIN*.com/displayname?user_id=@linkedin_tttt2-3892bvy478cy34by0283y908c4239==%3D%3D:matrix.*DOMAIN*.com&access_token=******' \
-H 'Content-Type: application/json' \
-d '{
"displayname": "Slim Shady from LinkedIn (LinkedIn)"
}'
{}%
@S7evinK
Copy link
Contributor

S7evinK commented Nov 13, 2023

Which makes sense imo, MX IDs are all lower case. If the LinkedIn Bridge uses the usual /register endpoint it should receive the lower cased user_id in the response and use that for further requests.

Only thing I find confusing is the /registerAvailable endpoint, which also lower cases [so this should be removed] the ID to check if the user is available, but doesn't return that the name is lower cased after registration.

@sumnerevans
Copy link

Dendrite should probably just be changed to handle legacy user IDs correctly: https://spec.matrix.org/v1.8/appendices/#historical-user-ids

@S7evinK
Copy link
Contributor

S7evinK commented Nov 14, 2023

That's not about legacy user IDs, which Dendrite handles correctly already.

If the bridge is using the "self generated" user_id (containing uppercase) for further requests to Dendrite after registering, it's not an issue of Dendrite but the bridge. The bridge, as mentioned, should use the returned user_id from https://spec.matrix.org/v1.8/client-server-api/#post_matrixclientv3register

@sumnerevans
Copy link

Currently, LinkedIn bridge usernames are case sensitive as they reflect the user IDs that LinkedIn itself uses.

I've created beeper/linkedin#65 to change this, but I'm not likely to get around to it anytime soon.

@S7evinK
Copy link
Contributor

S7evinK commented Feb 28, 2024

As mentioned above, not a Dendrite issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants