diff --git a/app/Livewire/Wireguard/Index.php b/app/Livewire/Wireguard/Index.php index 808e16f..3fea3f5 100644 --- a/app/Livewire/Wireguard/Index.php +++ b/app/Livewire/Wireguard/Index.php @@ -80,12 +80,9 @@ class Index extends Component 'danger' => true, 'icon' => 'trash', 'notify' => '', - 'token' => ConfirmToken::issue( - 'wgPeerRemoved', - ['name' => $name], - 'wg.remove-peer', - $name, - ), + // No audit descriptor — the apply path (removePeer) audits, so the confirm modal + // must NOT also audit (avoids a double audit row for one action). + 'token' => ConfirmToken::issue('wgPeerRemoved', ['name' => $name]), ], ); } @@ -144,12 +141,7 @@ class Index extends Component 'danger' => ! $on, 'icon' => 'shield', 'notify' => '', - 'token' => ConfirmToken::issue( - 'wgGateToggle', - ['on' => $on ? '1' : '0'], - $on ? 'wg.gate-up' : 'wg.gate-down', - $on ? 'on' : 'off', - ), + 'token' => ConfirmToken::issue('wgGateToggle', ['on' => $on ? '1' : '0']), ], ); } @@ -198,12 +190,7 @@ class Index extends Component 'danger' => true, 'icon' => 'alert', 'notify' => '', - 'token' => ConfirmToken::issue( - 'wgSetPort', - ['port' => $this->newPort], - 'wg.set-port', - $this->newPort, - ), + 'token' => ConfirmToken::issue('wgSetPort', ['port' => $this->newPort]), ], ); } @@ -220,8 +207,10 @@ class Index extends Component if (! $this->throttle()) { return; } - $this->pendingId = $bridge->request('set-port', ['port' => (string) ($payload['params']['port'] ?? '')]); + $port = (string) ($payload['params']['port'] ?? ''); + $this->pendingId = $bridge->request('set-port', ['port' => $port]); $this->pendingAction = 'set-port'; + $this->audit('wg.set-port', $port); $this->newPort = ''; } @@ -241,12 +230,7 @@ class Index extends Component 'danger' => true, 'icon' => 'alert', 'notify' => '', - 'token' => ConfirmToken::issue( - 'wgSetSubnet', - ['subnet' => $this->newSubnet], - 'wg.set-subnet', - $this->newSubnet, - ), + 'token' => ConfirmToken::issue('wgSetSubnet', ['subnet' => $this->newSubnet]), ], ); } @@ -263,8 +247,10 @@ class Index extends Component if (! $this->throttle()) { return; } - $this->pendingId = $bridge->request('set-subnet', ['subnet' => (string) ($payload['params']['subnet'] ?? '')]); + $subnet = (string) ($payload['params']['subnet'] ?? ''); + $this->pendingId = $bridge->request('set-subnet', ['subnet' => $subnet]); $this->pendingAction = 'set-subnet'; + $this->audit('wg.set-subnet', $subnet); $this->newSubnet = ''; }