Enhance Proxmox components with input validation, error handling, and UI improvements

This commit is contained in:
2026-02-25 07:00:55 -05:00
parent 16cd5f05de
commit 8494f87aae
19 changed files with 182 additions and 64 deletions

View File

@@ -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 {