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

@@ -946,6 +946,12 @@ class Firewall extends Component
}
if ($this->editingAliasName) {
if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_\-]*$/', $this->editingAliasName)) {
$this->error = 'Invalid alias name format';
$this->showErrorModal = true;
$this->loading = false;
return;
}
$response = $this->firewallRequest(
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/firewall/aliases/' . $this->editingAliasName,
'put',
@@ -1243,6 +1249,12 @@ class Firewall extends Component
$payload['nomatch'] = 1;
}
if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_\-]*$/', $this->selectedIPSetName ?? '')) {
$this->error = 'Invalid IPSet name format';
$this->showErrorModal = true;
$this->loading = false;
return;
}
$response = $this->firewallRequest(
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/firewall/ipset/' . $this->selectedIPSetName,
'post',
@@ -1283,6 +1295,12 @@ class Firewall extends Component
return;
}
if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_\-]*$/', $this->selectedIPSetName)) {
$this->error = 'Invalid IPSet name format';
$this->showErrorModal = true;
return;
}
$this->loading = true;
$this->showDeleteIPSetMemberModal = false;