Enhance Proxmox components with input validation, error handling, and UI improvements
This commit is contained in:
@@ -236,6 +236,12 @@ class BootOrder extends Component
|
||||
|
||||
public function removeCdDrive(string $drive)
|
||||
{
|
||||
// Validate drive format: only ide0-3 or sata0-5 are valid CD/DVD-ROM slots
|
||||
if (!preg_match('/^(ide|sata)\d+$/', $drive)) {
|
||||
$this->notify('Invalid drive identifier.', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array($drive, $this->cdDrives, true)) {
|
||||
$this->notify('Drive not found.', 'error');
|
||||
|
||||
@@ -287,6 +293,16 @@ class BootOrder extends Component
|
||||
: ($this->selectedIso ?: 'none');
|
||||
|
||||
$iso = $selectedIso ?: 'none';
|
||||
|
||||
// Validate the selected ISO against available options to prevent arbitrary paths
|
||||
if ($iso !== 'none') {
|
||||
$validIsos = collect($this->isoOptions)->pluck('value')->toArray();
|
||||
if (!in_array($iso, $validIsos, true)) {
|
||||
$this->notify('Invalid ISO selection.', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$value = $iso === 'none' ? 'none,media=cdrom' : $iso . ',media=cdrom';
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user