fix(validation): add URL validation for proxy redirect input (#9241)
This commit is contained in:
commit
71bafa0d54
1 changed files with 9 additions and 3 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
use App\Actions\Proxy\SaveProxyConfiguration;
|
use App\Actions\Proxy\SaveProxyConfiguration;
|
||||||
use App\Enums\ProxyTypes;
|
use App\Enums\ProxyTypes;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
|
use App\Rules\SafeExternalUrl;
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
|
|
@ -41,9 +42,13 @@ public function getListeners()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $rules = [
|
protected function rules()
|
||||||
'generateExactLabels' => 'required|boolean',
|
{
|
||||||
];
|
return [
|
||||||
|
'generateExactLabels' => 'required|boolean',
|
||||||
|
'redirectUrl' => ['nullable', new SafeExternalUrl],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
|
|
@ -147,6 +152,7 @@ public function submit()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->authorize('update', $this->server);
|
$this->authorize('update', $this->server);
|
||||||
|
$this->validate();
|
||||||
SaveProxyConfiguration::run($this->server, $this->proxySettings);
|
SaveProxyConfiguration::run($this->server, $this->proxySettings);
|
||||||
$this->server->proxy->redirect_url = $this->redirectUrl;
|
$this->server->proxy->redirect_url = $this->redirectUrl;
|
||||||
$this->server->save();
|
$this->server->save();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue