Skip to content
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

Not all username request are being set to lowercase #3263

Closed
matrixbot opened this issue Nov 1, 2024 · 5 comments
Closed

Not all username request are being set to lowercase #3263

matrixbot opened this issue Nov 1, 2024 · 5 comments

Comments

@matrixbot
Copy link
Collaborator

This issue was originally created by @raymatos at matrix-org/dendrite#3263.

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)"
}'
{}%
@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @S7evinK at matrix-org/dendrite#3263 (comment).

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.

@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @sumnerevans at matrix-org/dendrite#3263 (comment).

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

@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @S7evinK at matrix-org/dendrite#3263 (comment).

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

@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @sumnerevans at matrix-org/dendrite#3263 (comment).

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.

@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @S7evinK at matrix-org/dendrite#3263 (comment).

As mentioned above, not a Dendrite issue.

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

No branches or pull requests

1 participant