Skip to content

Commit c003977

Browse files
committed
fix: add missing validation for group name
1 parent f8c104c commit c003977

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Commands/User.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,11 @@ private function addgroup($group = null, $username = null, $email = null): void
603603
$group = $this->prompt('Group', null, 'required');
604604
}
605605

606+
// Validate the group
607+
if (! $this->validateGroup($group)) {
608+
throw new CancelException('Invalid group: "' . $group . '"');
609+
}
610+
606611
$user = $this->findUser('Add user to group', $username, $email);
607612

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

643+
// Validate the group
644+
if (! $this->validateGroup($group)) {
645+
throw new CancelException('Invalid group: "' . $group . '"');
646+
}
647+
638648
$user = $this->findUser('Remove user from group', $username, $email);
639649

640650
$confirm = $this->prompt(

0 commit comments

Comments
 (0)