Skip to content

Commit 9621f92

Browse files
committed
Merge branch 'develop' of https://github.com/Pterodactyl/Panel into develop
2 parents 5763493 + d726266 commit 9621f92

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

app/Http/Controllers/Admin/MountController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Pterodactyl\Http\Controllers\Admin;
44

55
use Ramsey\Uuid\Uuid;
6+
use Illuminate\Support\Str;
67
use Illuminate\Http\Request;
78
use Pterodactyl\Models\Nest;
89
use Pterodactyl\Models\Mount;
@@ -101,7 +102,6 @@ public function view($id)
101102
*/
102103
public function create(MountFormRequest $request)
103104
{
104-
/** @var \Pterodactyl\Models\Mount $mount */
105105
$model = (new Mount())->fill($request->validated());
106106
$model->forceFill(['uuid' => Uuid::uuid4()->toString()]);
107107

app/Models/Mount.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Pterodactyl\Models;
44

5+
use Illuminate\Validation\Rules\NotIn;
6+
57
/**
68
* @property int $id
79
* @property string $uuid
@@ -63,13 +65,47 @@ class Mount extends Model
6365
'user_mountable' => 'sometimes|boolean',
6466
];
6567

68+
/**
69+
* Implement language verification by overriding Eloquence's gather
70+
* rules function.
71+
*/
72+
public static function getRules()
73+
{
74+
$rules = parent::getRules();
75+
76+
$rules['source'][] = new NotIn(Mount::$invalidSourcePaths);
77+
$rules['target'][] = new NotIn(Mount::$invalidTargetPaths);
78+
79+
return $rules;
80+
}
81+
6682
/**
6783
* Disable timestamps on this model.
6884
*
6985
* @var bool
7086
*/
7187
public $timestamps = false;
7288

89+
/**
90+
* Blacklisted source paths
91+
*
92+
* @var string[]
93+
*/
94+
public static $invalidSourcePaths = [
95+
'/etc/pterodactyl',
96+
'/var/lib/pterodactyl/volumes',
97+
'/srv/daemon-data',
98+
];
99+
100+
/**
101+
* Blacklisted target paths
102+
*
103+
* @var string[]
104+
*/
105+
public static $invalidTargetPaths = [
106+
'/home/container',
107+
];
108+
73109
/**
74110
* Returns all eggs that have this mount assigned.
75111
*

0 commit comments

Comments
 (0)