mirror of
https://github.com/ovh/the-bastion.git
synced 2024-12-25 09:03:56 +08:00
fix: invalid suffixed account creation
This commit is contained in:
parent
036f921c40
commit
4d56c32853
3 changed files with 7 additions and 1 deletions
|
@ -12,4 +12,5 @@
|
|||
# Please keep the list sorted.
|
||||
#
|
||||
Adrien Barreau <adrien.barreau@ovhcloud.com>
|
||||
Cédric Roussel <cedric.roussel@ovhcloud.com>
|
||||
Stéphane Lesimple <stephane.lesimple@ovhcloud.com>
|
||||
|
|
|
@ -191,7 +191,7 @@ sub is_account_valid {
|
|||
elsif ($account =~ m/^[-.]/) {
|
||||
return R('KO_FORBIDDEN_PREFIX', msg => "$whatis name must not start with a '-' nor a '.'");
|
||||
}
|
||||
elsif ($account =~ m/-tty$/i) {
|
||||
elsif ($account =~ m/-(?:tty|aclkeeper|gatekeeper|owner)$/i) {
|
||||
return R('KO_FORBIDDEN_SUFFIX', msg => "$whatis name contains an unauthorized suffix");
|
||||
}
|
||||
elsif ($account =~ m/^key/i && $accountType ne 'group') {
|
||||
|
|
|
@ -161,6 +161,11 @@ ok(OVH::Bastion::is_account_valid(account => "azerty")->is_ok, "is_account_valid
|
|||
|
||||
is(OVH::Bastion::is_account_valid(account => "in valid")->err, "KO_FORBIDDEN_CHARS", "is_account_valid('in valid')");
|
||||
|
||||
for my $suffix (qw{ tty aclkeeper gatekeeper owner }) {
|
||||
is(OVH::Bastion::is_account_valid(account => "account-$suffix")->err,
|
||||
"KO_FORBIDDEN_SUFFIX", "is_account_valid('account-$suffix')");
|
||||
}
|
||||
|
||||
is(OVH::Bastion::is_account_valid(account => "root")->err, "KO_FORBIDDEN_NAME", "is_account_valid('root')");
|
||||
|
||||
ok(OVH::Bastion::is_bastion_account_valid_and_existing(account => "me")->is_ok,
|
||||
|
|
Loading…
Reference in a new issue