Skip to content

Override files in MagentoFrameworkFilesystemDirectory

In my local dev system I need to symlink modules into the /vendor folder. Unfortunately magento checks if any included file actually resides inside magento’s root folder.

Files from outside that scope are not permitted for security reasons.

Since I only need this in my local dev setup I wanted to override classes inside MagentoFrameworkFilesystemDirectory but that does not seem to work at all.

This is my etc/di.xml file:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="MagentoFrameworkFilesystemDirectoryPathValidator" type="MyModuleDirectoryPathValidatory" />
    <preference for="MagentoFrameworkFilesystemDirectoryDenyListPathValidator" type="MyModuleDirectoryDenyListPathValidator" />
    <preference for="MagentoFrameworkFilesystemDirectoryCompositePathValidator" type="MyModuleDirectoryCompositePathValidator" />
</config>

None of them make any difference.

Is there another way to override those files or even another way to disable this security check conditionally?

Thank you.