? Pending

User tests: Successful: Unsuccessful:

avatar jms2win
jms2win
28 Nov 2014

The filename field present in the Content-Disposition can be followed by other fields.
In this case, the target is wrong.

Here it is an example of Content-Disposition value.
attachment; filename="jms2win_checkupdates_1336.zip"; modification-date="Fri, 28 Nov 2014 13:57:42 +0100"; size=675299;

The bug is that the target value with the previous implementation were
jms2win_checkupdates_1336.zip"; modification-date="Fri, 28 Nov 2014 13:57:42 +0100"; size=675299
instead of return
jms2win_checkupdates_1336.zip

This fix should be also applied in J2.5 that were modified recently with the code that introduced this bug

avatar jms2win jms2win - open - 28 Nov 2014
avatar jissues-bot jissues-bot - change - 28 Nov 2014
Labels Added: ?
avatar Bakual
Bakual - comment - 28 Nov 2014

Please fix the codestyle issues Travis mentions.

For reference: The mentioned changes were done with PR #3182 and #4025.
@illovo and @phproberto may want to have a look at this since it was your PRs originally.

avatar Bakual
Bakual - comment - 28 Nov 2014

In 2.5 it was #4090 by @wilsonge

avatar roland-d
roland-d - comment - 6 Sep 2015

Tested this issue and can confirm the bug when the Content-Disposition has multiple entries. After applying the fix, the filename was correctly filtered out of the Content-Disposition string.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5238.

avatar roland-d roland-d - test_item - 6 Sep 2015 - Tested successfully
avatar brianteeman brianteeman - change - 30 Mar 2016
Category Libraries
avatar brianteeman
brianteeman - comment - 13 Apr 2016

Sorry I have no idea how to test this. Without any test instructions its just going to sit here until it is so old that it is just closed next month. @jms2win


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5238.

avatar brianteeman brianteeman - change - 13 Apr 2016
Status Pending Information Required
avatar jms2win
jms2win - comment - 14 Apr 2016

@brianteeman Yes this is a old bug that were confirmed and that is still present in J3.5.
This now make more than 1 year that we have to deliver the fix to our customers to allow them continue working correctly.
It would be good that finally Joomla include the fix that were confirmed.
Unfortunately as the bug were not included immediately in joomla, it still affect Joomla 2.5 that should also be fixed and for which we still have to deliver the patch as I suppose that you will no more update it.
We are lucky that Joomla 1.5 is NOT affected with this bug.

The test simply consists in creating a small program to check that the downloadPackage() function returns only a file name without any additional parameters.

Here it is a sample code that you can be use to verify the file name.
This sample calls our website to collect the free "Search/Replace" plugin that is delivered via the DOCMan extension.

In attachement, I join the plugin that contain this code.
pr5238.zip

Be-careful that once the plugin is enabled, its behavior is to DIE Joomla as long as the fix is not applied.

---- Test Code ------
defined('_JEXEC') or die;

class PlgSystemPR5238 extends JPlugin
{
public function onAfterInitialise()
{
$url = 'https://www.jms2win.com/index.php?option=com_docman&task=doc_download&gid=13';

  // Download the file from the URL given
  $p_file = JInstallerHelper::downloadPackage($url, 'sr2win.zip');
  if ( $p_file === false) {
     echo( 'Download ERROR');
  }
  else if ( ($p = strpos( $p_file, ';')) !== FALSE) {
    $validFilename = rtrim( substr( $p_file, 0, $p), '"');
    // https://github.com/joomla/joomla-cms/pull/5238
     die( "FATAL ERROR: Please fix the bug described in Pull Request 5238. Invalid file name returned: [$p_file]. Expected file name : [$validFilename]");
  }
  else {
     echo 'CONGRATULATION Joomla! The bug is fixed';
  }
}

}

---- Extract of DOCMan to send file in application of RFC2183 ------

For your information, DOCMan respect the "The Content-Disposition Header Field" as described in the RFC2183
https://tools.ietf.org/html/rfc2183

Here it is an extract of the code used in DOCMan to send the file.

header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");

header("Content-Transfer-Encoding: binary");
header('Content-Disposition:' . $cont_dis .';'
. ' filename="' . $this->name . '";'
. ' modification-date="' . $mod_date . '";'
. ' size=' . $fsize .';'
); //RFC2183
header("Content-Type: " . $this->mime ); // MIME type
header("Content-Length: " . $fsize);
<<< The File Content comes here >>>>

avatar brianteeman
brianteeman - comment - 14 Apr 2016

It will NOT be fixed in joomla 2.5 - that is EOL and not supported

On 14 April 2016 at 11:28, jms2win notifications@github.com wrote:

@brianteeman https://github.com/brianteeman Yes this is a old bug that
were confirmed and that is still present in J3.5.
This now make more than 1 year that we have to deliver the fix to our
customers to allow them continue working correctly.
It would be good that finally Joomla include the fix that were confirmed.
Unfortunately as the bug were not included immediately in joomla, it still
affect Joomla 2.5 that should also be fixed and for which we still have to
deliver the patch as I suppose that you will no more update it.
We are lucky that Joomla 1.5 is NOT affected with this bug.

The test simply consists in creating a small program to check that the
downloadPackage() function returns only a file name without any additional
parameters.

Here it is a sample code that you can be use to verify the file name.
This sample calls our website to collect the free "Search/Replace" plugin
that is delivered via the DOCMan extension.

In attachement, I join the plugin that contain this code.
pr5238.zip https://github.com/joomla/joomla-cms/files/218870/pr5238.zip

Be-careful that once the plugin is enabled, its behavior is to DIE Joomla
as long as the fix is not applied.

---- Test Code ------
defined('_JEXEC') or die;

class PlgSystemPR5238 extends JPlugin
{
public function onAfterInitialise()
{
$url = '
https://www.jms2win.com/index.php?option=com_docman&task=doc_download&gid=13
';

// Download the file from the URL given
$p_file = JInstallerHelper::downloadPackage($url, 'sr2win.zip');
if ( $p_file === false) {
echo( 'Download ERROR');
}
else if ( ($p = strpos( $p_file, ';')) !== FALSE) {
$validFilename = rtrim( substr( $p_file, 0, $p), '"');
// #5238
die( "FATAL ERROR: Please fix the bug described in Pull Request 5238. Invalid file name returned: [$p_file]. Expected file name : [$validFilename]");
}
else {
echo 'CONGRATULATION Joomla! The bug is fixed';
}
}

}

---- Extract of DOCMan to send file in application of RFC2183 ------

For your information, DOCMan respect the "The Content-Disposition Header
Field" as described in the RFC2183
https://tools.ietf.org/html/rfc2183

Here it is an extract of the code used in DOCMan to send the file.

header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");

header("Content-Transfer-Encoding: binary");
header('Content-Disposition:' . $cont_dis .';'
. ' filename="' . $this->name . '";'
. ' modification-date="' . $mod_date . '";'
. ' size=' . $fsize .';'
); //RFC2183
header("Content-Type: " . $this->mime ); // MIME type
header("Content-Length: " . $fsize);
<<< The File Content comes here >>>>


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#5238 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar RemcoJanssen RemcoJanssen - test_item - 15 Apr 2016 - Tested successfully
avatar RemcoJanssen
RemcoJanssen - comment - 15 Apr 2016

I have tested this item :white_check_mark: successfully on 2f525b8


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5238.

avatar brianteeman brianteeman - change - 8 May 2016
Status Information Required Ready to Commit
avatar brianteeman
brianteeman - comment - 8 May 2016

Finally this has been tested and can be merged. It is so much easier and faster if you write test instructions


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5238.

avatar joomla-cms-bot joomla-cms-bot - change - 8 May 2016
Labels Added: ?
avatar Kubik-Rubik
Kubik-Rubik - comment - 8 May 2016

Thank you @jms2win and testers!

avatar Kubik-Rubik Kubik-Rubik - change - 8 May 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-05-08 14:39:27
Closed_By Kubik-Rubik
avatar Kubik-Rubik Kubik-Rubik - close - 8 May 2016
avatar Kubik-Rubik Kubik-Rubik - merge - 8 May 2016
avatar joomla-cms-bot joomla-cms-bot - close - 8 May 2016
avatar joomla-cms-bot joomla-cms-bot - change - 8 May 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment