Deny /etc/pterodactyl as a source path for mounts
This commit is contained in:
parent
c52c5d6736
commit
f7520b721b
1 changed files with 10 additions and 0 deletions
|
@ -105,6 +105,11 @@ class MountController extends Controller
|
||||||
$model = (new Mount())->fill($request->validated());
|
$model = (new Mount())->fill($request->validated());
|
||||||
$model->forceFill(['uuid' => Uuid::uuid4()->toString()]);
|
$model->forceFill(['uuid' => Uuid::uuid4()->toString()]);
|
||||||
|
|
||||||
|
if (str_starts_with($model->source, '/etc/pterodactyl')) {
|
||||||
|
$this->alert->danger('Invalid source path: "/etc/pterodactyl" cannot be used as a source path.')->flash();
|
||||||
|
return redirect()->route('admin.mounts');
|
||||||
|
}
|
||||||
|
|
||||||
if (str_starts_with($model->source, '/var/lib/pterodactyl/volumes')) {
|
if (str_starts_with($model->source, '/var/lib/pterodactyl/volumes')) {
|
||||||
$this->alert->danger('Invalid source path: "/var/lib/pterodactyl/volumes" cannot be used as a source path.')->flash();
|
$this->alert->danger('Invalid source path: "/var/lib/pterodactyl/volumes" cannot be used as a source path.')->flash();
|
||||||
return redirect()->route('admin.mounts');
|
return redirect()->route('admin.mounts');
|
||||||
|
@ -145,6 +150,11 @@ class MountController extends Controller
|
||||||
|
|
||||||
$mount->forceFill($request->validated());
|
$mount->forceFill($request->validated());
|
||||||
|
|
||||||
|
if (str_starts_with($mount->source, '/etc/pterodactyl')) {
|
||||||
|
$this->alert->danger('Invalid source path: "/etc/pterodactyl" cannot be used as a source path.')->flash();
|
||||||
|
return redirect()->route('admin.mounts.view', $mount->id);
|
||||||
|
}
|
||||||
|
|
||||||
if (str_starts_with($mount->source, '/var/lib/pterodactyl/volumes')) {
|
if (str_starts_with($mount->source, '/var/lib/pterodactyl/volumes')) {
|
||||||
$this->alert->danger('Invalid source path: "/var/lib/pterodactyl/volumes" cannot be used as a source path.')->flash();
|
$this->alert->danger('Invalid source path: "/var/lib/pterodactyl/volumes" cannot be used as a source path.')->flash();
|
||||||
return redirect()->route('admin.mounts.view', $mount->id);
|
return redirect()->route('admin.mounts.view', $mount->id);
|
||||||
|
|
Loading…
Reference in a new issue