90152[BUGFIX] Skip consistency checks in ResourceStorage::addUploadedFile
Commit message
Review
-
Code review CR +2 Done
- Garvin Hicking +2
- Torben Hansen +1
- Stefan Froemken +1
-
Verified V +2 Done
- Garvin Hicking +2
- Torben Hansen +1
- Stefan Froemken +1
- core-ci +1 CI
Issues 1
Files 1
Review log 2124
-
Oliver Hader uploaded patch set 1 07/25/25, 08:48
-
core-ci voted on patch set 1 V +1 07/25/25, 08:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82308
-
Markus Klein voted on patch set 1 CR +1 07/25/25, 09:11
-
Garvin Hicking commented on patch set 1 07/25/25, 15:36
Not getting an exception anymore (yay), however upload of an `exe` file would now be possible with feature flags enabled and not having 'exe' listed in either mediafile_ext, miscfile_ext, textfile_ext...? -
Garvin Hicking commented on patch set 1 07/25/25, 16:27
I've uploaded my small extension: https://github.com/garvinhicking/extbase_upload/tree/v14-mime (use only that branch). It ships a very reduced Extbase CRUD Plugin that allows to upload files, and ships an example EXT:form file. Both ways have no MIME-Type restrictions. When used, I would expect "exe" files to not be allowed, given that: * feature flags `security.system.enforceFileExtensionMimeTypeConsistency` && `security.system.enforceAllowedFileExtensions` are enabled * `exe` not listed in either mediafile_ext, miscfile_ext, textfile_ext config * https://review.typo3.org/c/Packages/TYPO3.CMS/+/90134 is applied (otherwise EXT:form will crash on file uploads) -
Oliver Hader commented on patch set 1 CR -2 08/01/25, 11:15
On hold for the time being -
Oliver Hader commented on patch set 1 08/01/25, 11:45
Reply
https://review.typo3.org/c/Packages/TYPO3.CMS/+/90219 (or ensuring that Extbase file upload at least performs a mime-type consistency check) should be handled first. -
Garvin Hicking rebased onto patch set 2
CR +1V +108/02/25, 18:52Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**") -
core-ci voted on patch set 2 V +1 08/02/25, 19:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82670
-
Garvin Hicking rebased onto patch set 3
V +108/28/25, 19:06Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**") -
core-ci voted on patch set 3 V +1 08/28/25, 19:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83943
-
Oliver Hader voted on patch set 3 CR 0 08/28/25, 19:16
-
Oliver Hader commented on patch set 3 08/28/25, 19:18
Reply
Done -
Garvin Hicking voted on patch set 3 CR +1 V +1 08/28/25, 19:47
-
Torben Hansen voted on patch set 3 CR +1 V +1 08/29/25, 10:33
-
Stefan Froemken commented on patch set 3 V -1 08/29/25, 11:23
I don't get the point about this patch. I have activated "Security: system enforce file extension mime type consistency" (default). Now I create a text-file locally and rename that file to stefan.pdf. Without this patch I can not upload that file via EXT:form. Perfect! After applying this patch I CAN upload my stefan.pdf. This is not what I expect from the activated feature flag. -
Oliver Hader commented on patch set 3 08/29/25, 18:29
Reply
How did you configure your `ext:form` YAML definition? Did you configure a corresponding mime-type validation there? This patch is about delegating the checks to the more specific application (which is e.g. Extbase file-upload, import-export, or `ext:form`). -
Stefan Froemken commented on patch set 3 08/29/25, 20:51
Reply
I have following configured: - properties: saveToFileMount: '1:/user_upload/' allowedMimeTypes: - application/pdf - text/vcard type: FileUpload identifier: fileupload-1 label: 'File upload' I created stefan.vcard in PhpStorm, filled it with vcard stuff and renamed it to stefan.pdf. -
Garvin Hicking commented on patch set 3 09/05/25, 11:08
Reply
@froemken@gmail.com - You actually allowed "text/vcard" as a mimetype. So a file "stefan.pdf" with vcard contents would be fine! -
Oliver Hader commented on patch set 3 09/08/25, 19:16
Reply
The more specific application in `ext:form` correctly validated the mime-type of the submitted file content. Thus, there is no need to further block persistence in the low-level file abstraction layer. Enforcing resource consistence (or an additional file-name validator) would have to happen in `\TYPO3\CMS\Form\Mvc\Property\TypeConverter\UploadedFileReferenceConverter` instead. -
Stefan Froemken commented on patch set 3 CR +1 V +1 09/12/25, 12:48
I looked into the upload validation flow in detail. The reason why the unit test (https://review.typo3.org/c/Packages/TYPO3.CMS/+/90226) fails only on the Core side is that Extbase and FAL apply similar checks but with different defaults: 1. Extbase enforces FileNameValidator and FileExtensionMimeTypeConsistencyValidator. The FileExtensionValidator by default does not use Core defaults unless `useStorageDefaults = true`. That means a developer **can** allow e.g. `exe` files explicitly and Extbase will accept them. 2. When the file reaches the Core API, `ResourceConsistencyService` still applies the global checks (`textfile_ext`, `mediafile_ext`, `miscfile_ext`) and rejects the same file, even though Extbase already validated it. 3. The skip flag mechanism does not survive until `replaceFile()` / `addFile()`, so the Core ends up repeating validations. The patch removes duplicate checks in `addUploadedFile()`, so validations happen only once in `replaceFile()` / `addFile()`.Reply
Done -
Garvin Hicking voted on patch set 3 CR +2 V +2 09/12/25, 13:01
-
Garvin Hicking merged patch set 4 09/12/25, 13:04