Skip to content

Commit

Permalink
issue 2117: disallow admin username
Browse files Browse the repository at this point in the history
Signed-off-by: Linh Luong <bo17age@gmail.com>
  • Loading branch information
bo17age committed May 30, 2024
1 parent 58c41a7 commit 5036ff6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/osutil/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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_-]*$")

Check failure on line 38 in pkg/osutil/user.go

View workflow job for this annotation

GitHub Actions / Lints

SA1000: error parsing regexp: invalid or unsupported Perl syntax: `(?!` (staticcheck)

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

0 comments on commit 5036ff6

Please sign in to comment.