-
Notifications
You must be signed in to change notification settings - Fork 240
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
Little Bobby Tables #1151
base: master
Are you sure you want to change the base?
Little Bobby Tables #1151
Conversation
2e94516
to
08ea278
Compare
ca3d0f2
to
df6999b
Compare
I'd prefer aliasing --allow-badnames to --allow-unsafe-names. (But keeping the old name so anyone using it doesn't get their scripts broken). Calling it allow-unsafe-names gives the clear message that we don't advise doing it. But I don't think it's our place to try to force people to stop. If shadow itself is breaking on such names, then we should fix those places in shadow. The conern is that other userspace will break on the unsafe names. If someone makes a very tight full system where they're convinced unsafe names are fine for them, that's their prerogative. |
I agree whatever breaks in shadow should be fixed in shadow. It might be debatable what will be called broken though.
I agree, but I see it as not pushing the rest of userspace forward to a world where more names will be allowed in general. |
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
That's easier said than done. If one insists on using characters such as a newline, can we really "work"? root@359f6c0bddb0:/# cp /etc/passwd /tmp/passwd
root@359f6c0bddb0:/# useradd --badname '\n' root@359f6c0bddb0:/# diff -u /tmp/passwd /etc/passwd
--- /tmp/passwd 2024-12-10 22:56:06.914745615 +0000
+++ /etc/passwd 2024-12-10 22:56:57.662149407 +0000
@@ -16,3 +16,4 @@
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
_apt:x:42:65534::/nonexistent:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
+\n:x:1000:1000::/home/\n:/bin/sh root@359f6c0bddb0:/# useradd --badname '^M' root@359f6c0bddb0:/# diff -u /tmp/passwd /etc/passwd
--- /tmp/passwd 2024-12-10 22:56:06.914745615 +0000
+++ /etc/passwd 2024-12-10 22:57:43.377648075 +0000
@@ -16,3 +16,5 @@
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
_apt:x:42:65534::/nonexistent:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
+\n:x:1000:1000::/home/\n:/bin/sh
:/bin/sh1001::/home/ root@359f6c0bddb0:/# useradd --badname ':,'
useradd: failure while writing changes to /etc/passwd
root@359f6c0bddb0:/# useradd --badname ':'
useradd: failure while writing changes to /etc/passwd
root@359f6c0bddb0:/# useradd --badname ',' root@359f6c0bddb0:/# diff -u /tmp/passwd /etc/passwd
--- /tmp/passwd 2024-12-10 22:56:06.914745615 +0000
+++ /etc/passwd 2024-12-10 22:58:45.041004746 +0000
@@ -16,3 +16,6 @@
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
_apt:x:42:65534::/nonexistent:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
+\n:x:1000:1000::/home/\n:/bin/sh
:/bin/sh1001::/home/
+,:x:1002:1002::/home/,:/bin/sh |
d45dc82
to
eee679f
Compare
Some names are bad, and some names are really bad. '--badname' should only allow the mildly bad ones, which we can handle. Some names are too bad, and it's not possible to deal with them. Reject them unconditionally. Acked-by: Chris Hofstaedtler <zeha@debian.org> Cc: Marc 'Zugschlus' Haber <mh+githubvisible@zugschlus.de> Cc: Iker Pedrosa <ipedrosa@redhat.com> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Link: <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_265> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
In the first case, we can do the transformation because a few lines above, we explicitly reject a name starting with a '-'. In the second case, we're obviously using ispfchar() instead of its pattern. Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/, man/, src/: Do not allow bad names Closes: <shadow-maint#1149> Link: <https://www.wired.com/story/null-license-plate-landed-one-hacker-ticket-hell/> Link: <https://xkcd.com/327/> Link: <https://www.youtube.com/watch?v=hNoS2BU6bbQ> Link: <https://lwn.net/Articles/1001215/> Link: <https://dwheeler.com/essays/fixing-unix-linux-filenames.html> Link: <shadow-maint#121> Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=42874> Link: <https://lists.debian.org/debian-devel/2024/11/msg00250.html> Link: <https://lists.debian.org/debian-devel/2024/12/msg00012.html> Link: <https://lwn.net/Articles/1000485/> Cc: Iker Pedrosa <ipedrosa@redhat.com> Cc: Serge Hallyn <serge@hallyn.com> Cc: Sam James <sam@gentoo.org> Cc: Michael Vetter <jubalh@iodoru.org> Cc: Chris Hofstaedtler <zeha@debian.org> Cc: Balint Reczey <rbalint@debian.org> Cc: Marc Haber <mh+githubvisible@zugschlus.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
- Don't print the user name; if it's bad, it might be dangerous. - Print the string "user" or "group" before the error message. - Print the errno string to be consistent. Signed-off-by: Alejandro Colomar <alx@kernel.org>
eee679f
to
1cd7313
Compare
Closes: #1149
Link: https://www.wired.com/story/null-license-plate-landed-one-hacker-ticket-hell/
Link: https://xkcd.com/327/
Link: https://www.youtube.com/watch?v=hNoS2BU6bbQ
Link: https://lwn.net/Articles/1001215/
Link: https://dwheeler.com/essays/fixing-unix-linux-filenames.html
Link: #121
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=42874
Link: https://lists.debian.org/debian-devel/2024/11/msg00250.html
Link: https://lists.debian.org/debian-devel/2024/12/msg00012.html
Link: https://lwn.net/Articles/1000485/
Cc: @ikerexxe
Cc: @hallyn
Cc: @thesamesam
Cc: @jubalh
Cc: @zeha
Cc: @rbalint
Cc: @Zugschlus
While at it:
src/: Report errors in user or groups names more consistently
v1b
v2
v2b
v2c