Merge pull request #10478 from snipe/fixes/whitelist_modal_views

Added allow list to modal view options
This commit is contained in:
snipe 2021-12-30 18:29:30 -08:00 committed by GitHub
commit 39a5b6b426
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,31 @@ use App\Helpers\Helper;
class ModalController extends Controller class ModalController extends Controller
{ {
/**
* Load the modal views after confirming they are in the allowed_types array.
* The allowed types away just prevents shithead skiddies from fuzzing the urls
* with automated scripts and junking up the logs. - snipe
*/
function show ($type, $itemId = null) { function show ($type, $itemId = null) {
$allowed_types = [
'category',
'kit-model',
'kit-license',
'kit-consumable',
'kit-accessory',
'location',
'manufacturer',
'model',
'statuslabel',
'supplier',
'upload-file',
'user',
];
if (in_array($type, $allowed_types)) {
$view = view("modals.${type}"); $view = view("modals.${type}");
if ($type == "statuslabel") { if ($type == "statuslabel") {
@ -17,4 +41,8 @@ class ModalController extends Controller
} }
return $view; return $view;
} }
abort(404,'Page not found');
}
} }