-
Notifications
You must be signed in to change notification settings - Fork 241
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
lib/chkname.c, src/: Strictly disallow really bad names #1158
base: master
Are you sure you want to change the base?
lib/chkname.c, src/: Strictly disallow really bad names #1158
Conversation
dfb9f11
to
1c5acb5
Compare
lib/chkname.c
Outdated
if (streq(name, "") | ||
|| streq(name, ".") | ||
|| streq(name, "..") | ||
|| strpbrk(name, ",:") | ||
|| strchriscntrl(name) | ||
|| strisdigit(name)) | ||
{ | ||
errno = EINVAL; | ||
return false; | ||
} | ||
|
||
if (allow_bad_names) { | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zeha Do we have an agreement here? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that seems like a good plan to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take that as an Acked-by, if you don't mind. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
Acked-by: Chris Hofstaedtler [email protected]
The CI fails because I need to merge several PRs before this one:
|
5c45a5a
to
5369182
Compare
Before reviewing this PR I would like to come to an agreement on the long term path for this option, so let's wait for people to come and give us feedback at #1149. It will take some time to come to an agreement, but I think this is the best way forward. |
Hmmm, I was thinking the other way around: Whatever the agreement is for the future, some things should never be allowed. The files I would also include slashes and backslashes in the ban, but I don't know if this will mess with Microsoft Windows users. Anyone knows? |
Not allowing backslashes might cause issues with Windows, and Slashes in the user name are probably a bad idea because of usage in shell scripts. In any case, an implicitly generated home directory from a user name containing slashes is bad, so if slashes stay allowed in user names, the home directory MUST be explicitly given, or alternatively sanitized, e.g. s//_/g |
On Wed, Dec 25, 2024 at 11:27:49AM -0800, Zugschlus wrote:
Not allowing backslashes might cause issues with Windows, and Slashes in the user name are probably a bad idea because of usage in shell scripts. In any case, an implicitly generated home directory from a user name containing slashes is bad, so if slashes stay allowed in user names, the home directory MUST be explicitly given, or alternatively sanitized, e.g. s/\/_/g
Okay, so I'll add forward slashes to the ban.
Thanks!
…
--
Reply to this email directly or view it on GitHub:
#1158 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
5369182
to
810bc45
Compare
Done in v4 of this patch. |
I'm good with the intent of the patch. Would like to take a closer look at the details (have to look up the particulars of things like strpbrk every time) before merging. |
Thanks!
Sure. I need to check them every now and then. :) strpbrk() is kind of like strchr(), but with several chars for matching. The name is unfortunate, but that's a simple way of thinking about it. Here's a comparison of the descriptions in the manual pages:
I might have called it strchrs() instead... |
BTW, some of the APIs used in this patch are not yet merged. They are proposed in other PRs, which is why this thing is still a draft. Just in case you look up some definitions, they're not yet available. |
810bc45
to
5ddbdca
Compare
5ddbdca
to
8be46b3
Compare
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
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 <[email protected]> Cc: Marc 'Zugschlus' Haber <[email protected]> Cc: Iker Pedrosa <[email protected]> Cc: Serge Hallyn <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
8be46b3
to
0716561
Compare
Cc: @zeha
Cc: @Zugschlus
Cc: @ikerexxe
Cc: @hallyn
Revisions:
v1b
v2
v3
Spaces are used as structuring characters in several programs (e.g., id(1)). Don't mess with them.
v4
/
to the ban. [@Zugschlus ]v4b
Whoops, it seems this was supposed to be based after the streq branch.
v4c
v4d