Comment 5 for bug 1927078

Revision history for this message
Steve Langasek (vorlon) wrote :

> I think our preference would be to disallow leading numeric digits
> entirely so that for example, 0x0 and 0o0 would be blocked as well,
> to try to prevent both user and programmatic confusion.

Disallowing leading numeric digits entirely would, unfortunately, disable a significant class of valid usernames in conflict with historical usage.

The main motivation in fixing this is that allowing fully-numeric usernames means there is ambiguity in contexts that can reference both uids and usernames and do not have strong typing. Aside from systemd, this is mostly about shells and invocations of various commandline tools; and neither bash nor the tools appear to interpret 0o0 or 0x0 as numbers:

$ id 0o0
id: ‘0o0’: no such user
$ id 0x0
id: ‘0x0’: no such user
$ getent passwd 0x0
$ getent passwd 0o0

Let's please focus on the known problem case of all-numeric usernames. If there are other confirmed security issues with octal/hex representations of numbers, then we should also close those, but it needs a more precise fix than disabling leading digits.