Skip to content

Commit dc59408

Browse files
Yaroslav VoronoySergey Nosov
authored andcommitted
MAGETWO-47050: Magento 2: encryption keys generated in the admin interface are very weak
1 parent d9efe71 commit dc59408

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

app/code/Magento/EncryptionKey/Model/ResourceModel/Key/Change.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class Change extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
5858
* @param \Magento\Config\Model\Config\Structure $structure
5959
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
6060
* @param \Magento\Framework\App\DeploymentConfig\Writer $writer
61-
* @param \Magento\Framework\Math\Random $random
6261
* @param string $connectionName
6362
*/
6463
public function __construct(
@@ -137,6 +136,16 @@ public function getRandom()
137136
return $this->random;
138137
}
139138

139+
/**
140+
* Set Random
141+
*
142+
* @param \Magento\Framework\Math\Random $random
143+
*/
144+
public function setRandom(\Magento\Framework\Math\Random $random)
145+
{
146+
$this->random = $random;
147+
}
148+
140149
/**
141150
* Gather all encrypted system config values and re-encrypt them
142151
*

app/code/Magento/EncryptionKey/Test/Unit/Model/ResourceModel/Key/ChangeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ public function setUp()
8989
'resource' => $this->resourceMock,
9090
'transactionManager' => $this->tansactionMock,
9191
'relationProcessor' => $this->objRelationMock,
92-
'random' => $this->randomMock
9392
]
9493
);
94+
$this->model->setRandom($this->randomMock);
9595
}
9696

9797
private function setUpChangeEncryptionKey()

0 commit comments

Comments
 (0)