-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FOUR-21235 | Enforce File Upload Limit When Using Chunked File Upload Component #7838
base: release-2024-fall
Are you sure you want to change the base?
Conversation
…cessmaker into task/FOUR-21235
Let’s keep the current approach! Applying the middleware manually only where it’s needed and in the specific packages that require it. No global changes needed 👍 |
- Registered middleware globally in App\Http\Kernel.
…olve unused parameter warnings - Updated FileSizeCheck middleware to use the `terminate` method for global header addition. - Ensured compatibility with Response, JsonResponse, and StreamedResponse. - Removed unused `$request` parameter from the `terminate` method to resolve SonarLint/Intelephense warnings.
… ensure compatibility
- Mocked getMaxFileSize method in FileSizeCheck middleware for dynamic size limits. - Ensured middleware mock is correctly registered in the application container. - Updated tests to validate dynamic file size limits without relying on ini_set. - Added assertions to handle different configurations in local and deploy environments.
- Updated `isTemporaryTestFile` method to skip validation only for files in `/private/var/folders/` that are not of type `Illuminate\Http\Testing\File`. - Added a safeguard to ensure the check runs only in the `testing` environment.
Quality Gate passedIssues Measures |
Issue
Ticket: FOUR-21235
This PR implements
FileSizeCheck
middleware to enforce file upload limits for chunked uploads processed byvue-simple-uploader
andlaravel-chunk-upload
. The middleware compares the file size against user-specific limits set inphp-memory-limits.ini
(local) and99-processmaker.ini
(server).Solution
FileCheckMiddleware
inprocessmaker
ProcessMakerServiceProvider.php
How to Test
task/FOUR-21235
inprocessmaker
.php-memory-limits.ini
file and note the value ofupload_max_filesize
. If testing on the server, theupload_max_filesize
value is 24M.upload_max_filesize
:https://processmaker.test/api/1.0/requests/{request}/files
https://processmaker.test/api/1.0/processes/import/validation
https://processmaker.test/api/1.0/projects/import/validation
https://processmaker.test/api/1.0/pm-blocks/import/validation
https://processmaker.test/collections/import-chunked
https://processmaker.test/api/1.0/screens/import
https://processmaker.test/designer/decision-tables/import-chunked
https://processmaker.test/api/1.0/file-manager
upload_max_filesize
, such as a really large Collection or Screen, you can test to ensure that no errors are thrown when hitting these endpoints. But for the File Upload control in a Screen and the Public File upload, you should be able to upload any type of large file to test the functionality of the middleware.ci:package-collections:task/FOUR-21235
Code Review Checklist