Issue Bug Closed

#87048File search searches in forbidden folders => InsufficientFolderAccessPermissionsException

Philipp Seiler 11/30/18, 12:20 updated 12/06/22, 21:43

Description

- A backend user has certain folder permissions in fileadmin, not the whole fileadmin directory.
- User searches in one of those folders, e.g. the letter “a”.
- Within the searched folder, any file containing the letters “a” will be found.

- However: TYPO3 also searches for files by metadata!
- This includes files in user_upload directory.
- Any file in user_upload with the letter “a” will be found as well!
- user_upload is however not accessible by the user
- Therefore \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException is thrown.

Problem originates from \TYPO3\CMS\Core\Resource\FileRepository:
Here the searchByName-Method not only searches in the selected directory, but also metadata:

$fileRecords = $this->getFileIndexRepository()->findByFolders($folders, false, $fileName);
$fileRecords = array_merge($fileRecords, $this->getFileIndexRepository()->findBySearchWordInMetaData($fileName));

Quick solution

Simply remove the line which searches in metadata.

Proper solution

Respect accessible/forbidden folders when searching for files in the backend.

Reviews 2