Skip to content

Commit

Permalink
fix: add missing validation for group name
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Aug 21, 2024
1 parent f8c104c commit c003977
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Commands/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,11 @@ private function addgroup($group = null, $username = null, $email = null): void
$group = $this->prompt('Group', null, 'required');
}

// Validate the group
if (! $this->validateGroup($group)) {
throw new CancelException('Invalid group: "' . $group . '"');
}

$user = $this->findUser('Add user to group', $username, $email);

$confirm = $this->prompt(
Expand Down Expand Up @@ -635,6 +640,11 @@ private function removegroup($group = null, $username = null, $email = null): vo
$group = $this->prompt('Group', null, 'required');
}

// Validate the group
if (! $this->validateGroup($group)) {
throw new CancelException('Invalid group: "' . $group . '"');
}

$user = $this->findUser('Remove user from group', $username, $email);

$confirm = $this->prompt(
Expand Down

0 comments on commit c003977

Please sign in to comment.