mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
Is there really an invalid username? #259
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ploughpuff on GitHub (Jan 10, 2019).
UserManager has function IsValidUsername() and a comment within suggests usernames are limits to characters [a-z0-9-_'.]
Looking at the code, I cannot see how that's achieved (stale comment perhaps?). And in testing it sure does only guard against the use of '<' (U+003C) and '>' (U+003E) characters.
Question is, do we care what a valid username looks like?
Can this bunch of code be pruned away?
Edit by @JustAMan: I've added syntax highlighting
@LogicalPhallacy commented on GitHub (Jan 11, 2019):
This should probably not be pruned but should be updated to a piece of
regex that would restrict usernames to a reasonable policy for their
inevitable sql storage destination.
On Thu, Jan 10, 2019 at 12:52 PM ploughpuff notifications@github.com
wrote:
--
It has always been the prerogative of children and half-wits to point out
that the emperor has no clothes. But the half-wit remains a half- wit, and
the emperor remains an emperor.
@ploughpuff commented on GitHub (Jan 11, 2019):
At the moment the username is stored in the users db as part of a BLOB, so I guess there are no storage restrictions. If that approach changes I guess the datatype TEXT shall be used which supports UTF-8.
I also performed some testing with 2-byte wide chars (Greek letters) which are handled and displayed correctly. I'm not sure how you would craft a regex to handle Roman+Greek+Cyrillic+Chinese+BIG5 etc. etc. ?? Is that possible?
Alternatively, we scan the string for control characters (bytes <0x20)?
@JustAMan commented on GitHub (Jan 12, 2019):
I think there should be no restrictions. The only ones that remotely make sense are applied if username is passed in a web request or a DB query, but sane implementations of these escape their arguments properly anyway...