Skip to content

Commit f7520b7

Browse files
committed
Deny /etc/pterodactyl as a source path for mounts
1 parent c52c5d6 commit f7520b7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/Http/Controllers/Admin/MountController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ public function create(MountFormRequest $request)
105105
$model = (new Mount())->fill($request->validated());
106106
$model->forceFill(['uuid' => Uuid::uuid4()->toString()]);
107107

108+
if (str_starts_with($model->source, '/etc/pterodactyl')) {
109+
$this->alert->danger('Invalid source path: "/etc/pterodactyl" cannot be used as a source path.')->flash();
110+
return redirect()->route('admin.mounts');
111+
}
112+
108113
if (str_starts_with($model->source, '/var/lib/pterodactyl/volumes')) {
109114
$this->alert->danger('Invalid source path: "/var/lib/pterodactyl/volumes" cannot be used as a source path.')->flash();
110115
return redirect()->route('admin.mounts');
@@ -145,6 +150,11 @@ public function update(MountFormRequest $request, Mount $mount)
145150

146151
$mount->forceFill($request->validated());
147152

153+
if (str_starts_with($mount->source, '/etc/pterodactyl')) {
154+
$this->alert->danger('Invalid source path: "/etc/pterodactyl" cannot be used as a source path.')->flash();
155+
return redirect()->route('admin.mounts.view', $mount->id);
156+
}
157+
148158
if (str_starts_with($mount->source, '/var/lib/pterodactyl/volumes')) {
149159
$this->alert->danger('Invalid source path: "/var/lib/pterodactyl/volumes" cannot be used as a source path.')->flash();
150160
return redirect()->route('admin.mounts.view', $mount->id);

0 commit comments

Comments
 (0)