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

Disable character range check for user IDs #410

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions spec/userid.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,18 @@ func parseAndValidateUserID(id string, allowHistoricalIDs bool) (*UserID, error)
}

func historicallyValidCharacters(localpart string) bool {
for _, r := range localpart {
if r < 0x21 || r == 0x3A || r > 0x7E {
return false
// This check is currently not safe because Synapse has historically
// not enforced these character ranges properly, so there are many
// user IDs out in the wild that fall outside this (like with emoji).
// TODO: This function needs to be room version aware, as this will be
// fixed in a future room version.
/*
for _, r := range localpart {
if r < 0x21 || r == 0x3A || r > 0x7E {
return false
}
}
}
*/

return true
}
Loading