Skip to content

Commit bd618b3

Browse files
authored
Merge pull request #8537 from ProcessMaker/task/FOUR-26751
FOUR-26751: Make the dangerous_extensions verification configurable
2 parents 4c5eb45 + d44ee7d commit bd618b3

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

ProcessMaker/Http/Controllers/Api/ProcessRequestFileController.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,17 @@ public function destroy(Request $laravel_request, ProcessRequest $request, $file
450450
private function validateFile(UploadedFile $file, &$errors)
451451
{
452452
// Explicitly reject archive files for security
453-
$this->rejectArchiveFiles($file, $errors);
453+
if (config('files.enable_dangerous_validation')) {
454+
$this->rejectArchiveFiles($file, $errors);
455+
}
454456

455457
// Validate file extension if enabled
456-
if (config('files.enable_extension_validation', true)) {
458+
if (config('files.enable_extension_validation')) {
457459
$this->validateFileExtension($file, $errors);
458460
}
459461

460462
// Validate MIME type vs extension if enabled
461-
if (config('files.enable_mime_validation', true)) {
463+
if (config('files.enable_mime_validation')) {
462464
$this->validateExtensionMimeTypeMatch($file, $errors);
463465
}
464466

config/files.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@
7272
'mp4' => ['video/mp4'],
7373
],
7474

75+
/*
76+
|--------------------------------------------------------------------------
77+
| Enable DANGEROUS Validation
78+
|--------------------------------------------------------------------------
79+
|
80+
| Whether to enable dangerous file validation that checks against
81+
|
82+
*/
83+
'enable_dangerous_validation' => env('ENABLE_DANGEROUS_VALIDATION', true),
84+
7585
/*
7686
|--------------------------------------------------------------------------
7787
| Enable MIME Type Validation

0 commit comments

Comments
 (0)