Review 13.4 Merged

93050[BUGFIX] Prevent InsufficientFolderAccessPermissionsException in form preview

Garvin Hicking CR +2 V +2 Normal +128 −13 updated 03/04/26, 13:10

Commit message

When a non-admin backend editor previews a form containing a
FileUpload element that targets a file storage the editor has no
access to, an InsufficientFolderAccessPermissionsException is thrown.

This happens because PropertyMappingConfiguration::afterBuildingFinished() resolves
the upload target folder via ResourceFactory, which checks file
storage permissions. The catch block in checkSaveFileMountAccess()
only caught \InvalidArgumentException, letting access permission
and folder-not-found exceptions bubble up.

Three changes fix this:

1. PropertyMappingConfiguration::checkSaveFileMountAccess() now additionally catches
   InsufficientFolderAccessPermissionsException and
   FolderDoesNotExistException, returning false instead of
   throwing.

2. PropertyMappingConfiguration::afterBuildingFinished() skips the entire upload
   folder resolution when the rendering option "previewMode" is
   enabled, since file uploads are non-functional during preview.

3. To make the previewMode option available during form element
   initialization, ArrayFormFactory::build() now applies
   renderingOptions before processing renderables, and
   FormEditorController::renderFormPageAction() sets previewMode
   in the configuration array before calling build().

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
  • Verified V +2 Done
    • Garvin Hicking +2
    • core-ci +1 CI

Issues 1

Files 4

Review log 69

  1. Garvin Hicking commented on patch set 1 03/03/26, 22:04

    Cherry Picked from branch main. The following files contain Git conflicts: * typo3/sysext/form/Classes/Domain/Model/FormElements/FileUpload.php * typo3/sysext/form/Tests/Unit/Domain/FormElements/FileUploadTest.php
  2. core-ci voted on patch set 1 V -1 03/03/26, 22:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97231

  3. Josua Vogel uploaded patch set 2 V -1 03/04/26, 07:47

  4. Josua Vogel updated the commit message in patch set 3 03/04/26, 07:48

  5. core-ci voted on patch set 2 V +1 03/04/26, 07:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97265

  6. core-ci voted on patch set 3 V +1 03/04/26, 07:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97266

  7. Garvin Hicking marked it ready for review 03/04/26, 13:04

  8. Garvin Hicking voted on patch set 3 CR +2 V +2 03/04/26, 13:09

  9. Garvin Hicking merged patch set 4 03/04/26, 13:10