Review main Merged

94684[SECURITY] Register MimeTypeValidator for file uploads at runtime

Josua Vogel CR +2 V +2 Hard +381 −52 updated 07/14/26, 12:08

Commit message

The "allowedMimeTypes" restriction of the FileUpload and ImageUpload
form elements was never enforced on the server side. Uploading a file
whose MIME type is not part of the configured list (e.g. a PNG while
only "application/pdf" is allowed) passed validation and the form was
processed as valid, including running finishers.

Root cause is a timing issue during form building:
FileUpload::initializeFormElement() registered the MimeTypeValidator
based on the "allowedMimeTypes" property. However, the method
initializeFormElement() is called from AbstractSection::createElement()
*before* the concrete form definition properties are applied via the
second setOptions() call in ArrayFormFactory::addNestedRenderable().
As the prototype type definition does not contain "allowedMimeTypes",
the property was always empty at that point and the validator was never
added to the ProcessingRule. The client-side "accept" attribute was
therefore the only remaining barrier, which can be trivially bypassed
in the browser file picker.

The MimeTypeValidator registration is now performed at runtime in
PropertyMappingConfiguration::adjustPropertyMappingForFileUploadsAtRuntime(),
where the form definition properties are fully available and which runs
before the submitted values are validated. The same class already sets
the upload seed and removal configuration there for the exact same
reason. Registration is guarded against duplicates.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
  • Verified V +2 Done
    • Oliver Hader +2
    • core-ci +1 CI

Issues 1

Files 7

Review log 2534

Show 69 earlier messages
  1. Josua Vogel uploaded patch set 1 07/06/26, 11:18

  2. Josua Vogel uploaded patch set 2 07/06/26, 11:21

  3. Josua Vogel marked it work in progress 07/06/26, 11:31

  4. core-ci voted on patch set 1 V -1 07/06/26, 11:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104399

  5. core-ci voted on patch set 2 V -1 07/06/26, 11:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104400

  6. Josua Vogel uploaded patch set 3 V -1 07/06/26, 11:54

  7. Oliver Hader wrote 07/06/26, 11:54

    Set private
  8. core-ci voted on patch set 3 V +1 07/06/26, 12:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104402

  9. Oliver Hader commented on patch set 3 07/08/26, 20:11

    This would be a change for v14.3 as well, wouldn't it?
  1. Garvin Hicking commented on patch set 3 07/08/26, 20:33

    Reply

    Yes. I've for now only glanced at this, but from code reading this looks sane. Since this kind or "publically leaked" do you think we can/should wrap this up for next tuesday's release, or is that unrealistic due to dialogue days and such?
  2. Oliver Hader updated the commit message in patch set 4 V +1 07/09/26, 16:21

  3. Oliver Hader commented on patch set 4 07/09/26, 16:22

    Reply

    Next Tuesday would be great. And somehow we (or I) must find a way to make this work, even if there are other "event".
  4. core-ci voted on patch set 4 V +1 07/09/26, 16:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104575

  5. Oliver Hader commented on patch set 4 07/09/26, 16:32

    ``` Security-Bulletin: TYPO3-CORE-SA-2026-019 Security-References: CVE-2026-15305 ```
  6. Oliver Hader commented on patch set 4 07/09/26, 17:38

    There still is another flaw, since the validation logic was moved form the `UploadedFileReferenceConverter` to `\TYPO3\CMS\Form\Mvc\ProcessingRule::process`, it means that invalid files (e.g. `malicous.exe`) are persisted again and remain in the directory when the validation failed. Previously `\TYPO3\CMS\Form\Mvc\Property\TypeConverter\PseudoFile` is `UploadedFileReferenceConverter` handled that, without having the necessity to use a real persisted FAL file or file-reference object.
  7. Oliver Hader uploaded patch set 5 V +1 07/09/26, 18:49

  8. core-ci voted on patch set 5 V +1 07/09/26, 18:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104576

  9. Garvin Hicking commented on patch set 5 07/09/26, 19:06

    PropertyMappingConfiguration.php:95

    Nice. I played around with this today and was on with a very similar solution. Will test yours more in detail tomorrow. Sorry for not catching this initially for the feature, mea culpa.
  10. Oliver Hader commented on patch set 5 07/10/26, 14:29

    This change is ready for review.
  11. Oliver Hader voted on patch set 5 CR +1 V +1 07/10/26, 14:29

  12. Garvin Hicking uploaded patch set 6 CR +1 V +1 07/10/26, 15:47

  13. Garvin Hicking commented on patch set 6 CR +1 V +1 07/10/26, 15:51

    PropertyMappingConfiguration.php:95 Reply

    I've spent too many hours today to do a lot of manual testing. I created form variants for: mimeupload-single: One step, one single file upload, one single image upload mimeupload-single-extravalidate: As above, but each upload field has a filesize validator on top mimeupload-single-multipage: As above, but a second page (to ensure not forwarding to the next page) mimeupload-multi, mimeupload-multi-extravalidate, mimeupload-multi-multipage: As above, but with "multiple" upload fields mimeupload-all: As above, but with both single AND multiple file uploads variants on the same page In each form I then uploaded: - all valid files - modified the DOM to remove `accept` and upload invalid files - upload `.php` files - in multiple upload fields, combined valid and invalid uploads - upload files valid and invalid, matching and not matching the filesize validators I think I saw the file upload picker more than 100 times today. It all seemed to work without regressions and without allowing to persist the denied files, plus emitting proper validation failures.
  14. core-ci voted on patch set 6 V +1 07/10/26, 15:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104637

  15. Oliver Hader commented on patch set 6 07/10/26, 19:40

    Reply

    Done
  16. Torben Hansen voted on patch set 3 CR +1 V +1 07/11/26, 10:33

  17. Josua Vogel voted on patch set 6 CR +1 V +1 07/11/26, 13:44

  18. Oliver Hader rebased onto patch set 7 CR +1 V +1 07/14/26, 08:24

  19. Oliver Hader commented on patch set 7 07/14/26, 08:25

    Reply

    Done
  20. core-ci voted on patch set 7 V -1 07/14/26, 08:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104743

  21. core-ci commented on patch set 7 07/14/26, 10:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104743

  22. core-ci voted on patch set 7 V +1 07/14/26, 11:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104743

  23. Oliver Hader wrote 07/14/26, 12:05

    Unset private
  24. Oliver Hader voted on patch set 7 CR +2 V +2 07/14/26, 12:08

  25. Oliver Hader merged patch set 8 07/14/26, 12:08