Skip to content

Commit

Permalink
exclude admin form allowed username; use fallback username
Browse files Browse the repository at this point in the history
  • Loading branch information
bo17age committed May 30, 2024
1 parent 58c41a7 commit d8f520c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/osutil/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ 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("^[a-z_][a-z0-9_-]*$")
var regexUsername = regexp.MustCompile("^(?!admin)([a-z_][a-z0-9_-]*)$")

Check failure on line 39 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 d8f520c

Please sign in to comment.