Child pages
  • [security] Abstract all interactions with filesystem into separate layer [5.3.0-B1]
Skip to end of metadata
Go to start of metadata

The interactions with a filesystem is a common attack vector. For example if used incorrectly the code might allow to write content provided to request at arbitrary location on filesystem.

It's pretty hard to protect all current and future places in code, where file functions are used, because:

The obvious solution would be to move all file-related operations into a dedicated new class (filesystem access layer) that will ensure that no harm can be done. Turns out, that there are already some libraries, that do this for us:

Strangely enough Symfony provided solution isn't the best of them.

Another side benefit of using filesystem abstraction layer is to define sub-layers (e.g. for uploaded files, for cached stuff) and then be able to individually move data in these layers. This might prove useful, when deploying In-Portal to the cloud.

Solution

  1. connect chosen Filesystem abstraction layer to In-Portal
  2. locate all places, where filesystem is accessed (read/write/etc.)
  3. use Filesystem adapter to do all the work

Related Tasks