ZIP including private files is publicly available  

Created on 30 April 2019, over 5 years ago
Updated 2 May 2024, 8 months ago

ZIP files generated by this module are placed in DRUPAL_ROOT . '/sites/default/files/daf_zips, which is publicly available by default. In our case the plugins formatter is set to a private file field, so it generates a ZIP including private files. If the ZIP filename is known (which would be possible by guessing), private files would be publicly available.
I suggest saving the zip files with a non-guessable name. An alternative would be not to save the generated ZIP files, to do that the BinaryFileResponse->deleteFileAfterSend method can be set to true.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇩🇪Germany muelheim-ruhr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy Giuseppe87

    I've updated the #5 patch, adding the deletion of the file after the send.
    Otherwise the physical file would be still accessibile with the direct link to anyone.

    This also require the removal of

        // If zip file is already present and node is not been changed since
        // Then just stream it directly.
        if (file_exists($file_path)) {
          $file_last_modified = filemtime($file_path);
          $node_changed = $node->getChangedTime();
          if ($node_changed < $file_last_modified) {
            return $this->streamZipFile($file_path);
          }
        }
    

    Which definitely make the download less optimized.

    I don't know if it would be worthy - and if it's possible - to have 2 different logic in case of public and private field files.
    Being a 5 years old (security) issue, I'm putting in Needs Review, hoping it will move more quickly.

Production build 0.71.5 2024