X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/895f656897c70190b8e0a4e426a56b9df83a23b2..refs/pull/3349/head:/app/Http/Controllers/SettingController.php diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 7f7f4c9ca..3d1c184cd 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -11,6 +11,8 @@ class SettingController extends Controller { protected ImageRepo $imageRepo; + protected array $settingCategories = ['features', 'customization', 'registration']; + public function __construct(ImageRepo $imageRepo) { $this->imageRepo = $imageRepo; @@ -21,6 +23,7 @@ class SettingController extends Controller */ public function index(string $category) { + $this->ensureCategoryExists($category); $this->checkPermission('settings-manage'); $this->setPageTitle(trans('settings.settings')); @@ -39,6 +42,7 @@ class SettingController extends Controller */ public function update(Request $request, string $category) { + $this->ensureCategoryExists($category); $this->preventAccessInDemoMode(); $this->checkPermission('settings-manage'); $this->validate($request, [ @@ -73,4 +77,11 @@ class SettingController extends Controller return redirect("/settings/${category}"); } + + protected function ensureCategoryExists(string $category): void + { + if (!in_array($category, $this->settingCategories)) { + abort(404); + } + } }