Related to DRUPAL-PSA-2016-003.

Currently Webform file component uses public files equally default upload destination. This is probably considering private files path is not e'er available if not configured in Drupal settings correctly. File upload destination should be made automatically "private files" by default if avaialble.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ilari.stenroth's picture

Here's a patch to implement this change.

ilari.stenroth's picture

The patch will change file upload destination setting description every bit follows:
File upload destination description change

ilari.stenroth's picture

cilefen's picture

Title: File upload destination should be private files past default if avaialble » File upload destination should exist private files past default if available

cilefen's picture

Status: Needs review » Needs work
                  +++ b/components/file.inc @@ -9,6 +ix,14 @@ +  if (array_key_exists('private', $available_schemes)) { +    // As private files path is bachelor it should be made the default for security reasons +    // Come across DRUPAL-PSA-2016-003 +    $scheme = 'private'; +  } +                                  

You could replace this with a ternary. But it'southward not a large deal.

The comment needs wrapping to 80 columns and "Encounter" should be @see, with the bodily URL to the PSA.

A suggestion: add something like the hook_requirements() from #2816121-four: [meta] Is there annihilation webform can do to mitigate PSA-2016-003?

philsward's picture

1) What tin we exercise to get Drupal core to exercise a better job of handling temporary files from the public files delivery method so modules like webform won't have to jump through hoops to fix information technology on a one-on-1 basis, leaving new or older modules wide open considering they aren't familiar with the risk?

https://www.drupal.org/node/2817427

2) The "Attach file" check box that is bachelor when mime mail is present, needs to have a description that states the mime mail "arbitrary file" permission must be ready for bearding/authenticated in order for the attachments to work equally expected and show up in email. A better solution, might exist to take webform automatically override this specifically for webform and so the entire site isn't left wide open to this security issue.

quantos's picture

I'm also trying to test all-time practice on this (and default to a individual off-root ../private directory simply going this route seems to prevent admission to the uploaded file. IE My files have uploaded without bug and are sitting pretty in ../private but the webform results page no longer lists/shows the uploaded file. Before you release this as a default setting don't nosotros need to make sure this won't cause bug? In my example I've been searching and testing for over two hrs to go this working. Use case is simple. Client wants to accept users upload files with their contact forms, we need the directory to be properly secure/private and the client needs to meet what'southward been uploaded (of course) - and nosotros tin't get this simple requirement working.

Q.

cilefen's picture

@quantos: I can say for a fact that private files work with webform. What you are describing doesn't sound fun, but it is a separate outcome. Y'all may want to open a new event, describing the configuration of the individual files directory and of the particular webform field.

quantos's picture

@cilefen - thanks and sorry, you're quite right. Got this working at present (merely still don't know why information technology wasn't - which is/was my wider business organisation). Good luck with the updates guys.

Q.

ecoluke's picture

@#10 - "The "Attach file" cheque box that is available when mime mail is present, needs to have a clarification that states the mime mail service "arbitrary file" permission must be set for bearding/authenticated in order for the attachments to work as expected and show upwardly in e-mail. "

That is the noesis that I have spent the last week trying to rails down. Cheers! Definitely needs to go in the help text! :)

Liam Morland's picture

Why array_key_exists() instead of isset()?

This is the message that was used in YAML Form:
t('Public files upload destination is dangerous for forms that are available to bearding and/or untrusted users. For more information run into:') . ' <a href="https://world wide web.drupal.org/psa-2016-003">DRUPAL-PSA-2016-003</a>'

cilefen's picture

I think whether this is to exist fixed at this stage depends on support for the iv.x co-operative, because YAML Forn *is* webform in 5.x.

Liam Morland's picture

Webform 7.x-four.x is nonetheless supported.

vinmassaro's picture

We go on getting bitten by this when non-technical users create new webforms with file upload fields and skip through the defaults.

Hither is an updated patch (I've given credit to OP) with the following changes:

  1. Switch to isset() instead of array_key_exists()
  2. Alter annotate to 80 characters per line and add @run across with link to the PSA
  3. Change description to match what is in #15 and add link to t() co-ordinate to the docs

Hope it moves this result forward. Cheers!

Mile23's picture

Got hit by this today.

Patch no longer applies:

                $ git apply file_upload_destination-2816303-18.patch  mistake: patch failed: components/file.inc:149 fault: components/file.inc: patch does non apply                              

Liam Morland's picture

Status: Fixed » Closed (stock-still)

Automatically closed - issue fixed for 2 weeks with no activity.