Skip to content

Commit ffcbbd3

Browse files
Disable character range check for user IDs (#410)
This check is not safe in existing room versions because Synapse hasn't enforced it properly either. Related: matrix-org/matrix-spec#1506, matrix-org/matrix-spec-proposals#2828 Signed-off-by: Neil Alexander <git@neilalexander.dev> Signed-off-by: Neil Alexander <git@neilalexander.dev> Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com> Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com>
1 parent eb14008 commit ffcbbd3

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

spec/userid.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,18 @@ func parseAndValidateUserID(id string, allowHistoricalIDs bool) (*UserID, error)
8787
}
8888

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

96103
return true
97104
}

0 commit comments

Comments
 (0)