Skip to content

Commit 6caa592

Browse files
committed
MAGETWO-85143: Stored XSS - Downloadable products (Exfiltrating database, admin takeover)
1 parent fd5b192 commit 6caa592

File tree

1 file changed

+16
-11
lines changed
  • app/code/Magento/Downloadable/Test/Unit/Controller/Download

1 file changed

+16
-11
lines changed

app/code/Magento/Downloadable/Test/Unit/Controller/Download/LinkTest.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,23 @@ public function testLinkNotAvailable($messageType, $status, $notice)
411411
*/
412412
public function testContentDisposition($mimeType, $disposition)
413413
{
414-
$this->objectManager->expects($this->at(0))
414+
$this->objectManager->expects($this->any())
415415
->method('get')
416-
->with(\Magento\Customer\Model\Session::class)
417-
->willReturn($this->session);
416+
->willReturnMap([
417+
[
418+
\Magento\Customer\Model\Session::class,
419+
$this->session,
420+
],
421+
[
422+
\Magento\Downloadable\Helper\Data::class,
423+
$this->helperData,
424+
],
425+
[
426+
\Magento\Downloadable\Helper\Download::class,
427+
$this->downloadHelper,
428+
],
429+
]);
430+
418431
$this->request->expects($this->once())->method('getParam')->with('id', 0)->willReturn('some_id');
419432
$this->objectManager->expects($this->at(1))
420433
->method('create')
@@ -425,10 +438,6 @@ public function testContentDisposition($mimeType, $disposition)
425438
->with('some_id', 'link_hash')
426439
->willReturnSelf();
427440
$this->linkPurchasedItem->expects($this->once())->method('getId')->willReturn(5);
428-
$this->objectManager->expects($this->at(2))
429-
->method('get')
430-
->with(\Magento\Downloadable\Helper\Data::class)
431-
->willReturn($this->helperData);
432441
$this->helperData->expects($this->once())
433442
->method('getIsShareable')
434443
->with($this->linkPurchasedItem)
@@ -442,10 +451,6 @@ public function testContentDisposition($mimeType, $disposition)
442451
$fileSize = 58493;
443452
$fileName = 'link.jpg';
444453

445-
$this->objectManager->expects($this->at(3))
446-
->method('get')
447-
->with(\Magento\Downloadable\Helper\Download::class)
448-
->willReturn($this->downloadHelper);
449454
$this->downloadHelper->expects($this->once())
450455
->method('setResource')
451456
->with('link_url', 'url')

0 commit comments

Comments
 (0)