Skip to content
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

issue 2117: disallow admin username #2378

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
issue 2117: disallow admin username
Signed-off-by: Linh Luong <[email protected]>
Signed-off-by: bo17age <[email protected]>
bo17age committed Sep 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 5444626ca58a147f60c8f4959df1e7b564c5847b
2 changes: 1 addition & 1 deletion pkg/osutil/user.go
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ var (
// regexUsername matches user and group names to be valid for `useradd`.
// `useradd` allows names with a trailing '$', but it feels prudent to map those
// names to the fallback user as well, so the regex does not allow them.
var regexUsername = regexp.MustCompile("^[a-z_][a-z0-9_-]*$")
var regexUsername = regexp.MustCompile("^(?!admin$)[a-z_][a-z0-9_-]*$")

// regexPath detects valid Linux path.
var regexPath = regexp.MustCompile("^[/a-zA-Z0-9_-]+$")