Skip to content

Commit cdd4d4b

Browse files
authored
Merge pull request #6772 from magento-tsg/MC-41213
[Arrows] MC-41213: Update existing Magento 2.4 code to pass Insecure Function phpcs checks
2 parents 7aed4cd + e36cb3c commit cdd4d4b

File tree

59 files changed

+142
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+142
-6
lines changed

app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ protected function _getConfigUrl()
101101
*/
102102
public function getIdentity()
103103
{
104+
// md5() here is not for cryptographic use.
105+
// phpcs:ignore Magento2.Security.InsecureFunction
104106
return md5('BASE_URL' . $this->_getConfigUrl());
105107
}
106108

app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ protected function _getCacheTypesForRefresh()
6262
*/
6363
public function getIdentity()
6464
{
65+
// md5() here is not for cryptographic use.
66+
// phpcs:ignore Magento2.Security.InsecureFunction
6567
return md5('cache' . implode(':', $this->_getCacheTypesForRefresh()));
6668
}
6769

app/code/Magento/AsynchronousOperations/Model/ResourceModel/System/Message/Collection/Synchronized/Plugin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public function afterToArray(
108108
'data' => [
109109
'text' => __('Task "%1": ', $bulk->getDescription()) . $text,
110110
'severity' => \Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR,
111+
// md5() here is not for cryptographic use.
112+
// phpcs:ignore Magento2.Security.InsecureFunction
111113
'identity' => md5('bulk' . $bulkUuid),
112114
'uuid' => $bulkUuid,
113115
'status' => $bulkStatus,

app/code/Magento/Backend/Test/Mftf/Helper/CurlHelpers.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public function assertImageContentIsEqual($url, $expectedString, $postBody = nul
4949
$imageContent = $this->getCurlResponse($url, $cookie, $postBody);
5050
// Must make request twice until bug is resolved: B2B-1789
5151
$imageContent = $this->getCurlResponse($url, $cookie, $postBody);
52+
// md5() here is not for cryptographic use.
53+
// phpcs:ignore Magento2.Security.InsecureFunction
5254
$imageContentMD5 = md5($imageContent);
5355
$this->assertStringContainsString($expectedString, $imageContentMD5, $message);
5456
}

app/code/Magento/Catalog/Block/Navigation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ public function getCacheKeyInfo()
152152

153153
$shortCacheId = array_values($shortCacheId);
154154
$shortCacheId = implode('|', $shortCacheId);
155+
// md5() here is not for cryptographic use.
156+
// phpcs:ignore Magento2.Security.InsecureFunction
155157
$shortCacheId = md5($shortCacheId);
156158

157159
$cacheId['category_path'] = $this->getCurrentCategoryKey();

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ protected function generateCode($label)
126126
);
127127
$validatorAttrCode = new \Zend_Validate_Regex(['pattern' => '/^[a-z][a-z_0-9]{0,29}[a-z0-9]$/']);
128128
if (!$validatorAttrCode->isValid($code)) {
129+
// md5() here is not for cryptographic use.
130+
// phpcs:ignore Magento2.Security.InsecureFunction
129131
$code = 'attr_' . ($code ?: substr(md5(time()), 0, 8));
130132
}
131133
return $code;

app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function validate($processingParams, $option)
213213
}
214214
}
215215

216-
$fileHash = md5($tmpDirectory->readFile($tmpDirectory->getRelativePath($fileInfo['tmp_name'])));
216+
$fileHash = hash('sha256', $tmpDirectory->readFile($tmpDirectory->getRelativePath($fileInfo['tmp_name'])));
217217

218218
$userValue = [
219219
'type' => $fileInfo['type'],

app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function validate($optionValue, $option)
125125
*/
126126
protected function buildSecretKey($fileRelativePath)
127127
{
128-
return substr(md5($this->rootDirectory->readFile($fileRelativePath)), 0, 20);
128+
return substr(hash('sha256', $this->rootDirectory->readFile($fileRelativePath)), 0, 20);
129129
}
130130

131131
/**

app/code/Magento/Catalog/Model/Webapi/Product/Option/Type/File/Processor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function processFileContent(ImageContentInterface $imageContent)
5959
$filePath = $this->saveFile($imageContent);
6060

6161
$fileAbsolutePath = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath($filePath);
62-
$fileHash = md5($this->filesystem->getDirectoryRead(DirectoryList::MEDIA)->readFile($filePath));
62+
$fileHash = hash('sha256', $this->filesystem->getDirectoryRead(DirectoryList::MEDIA)->readFile($filePath));
6363
$imageSize = getimagesize($fileAbsolutePath);
6464
$result = [
6565
'type' => $imageContent->getType(),

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
?>
99

1010
// phpcs:disable Magento2.Security.InsecureFunction.DiscouragedWithAlternative
11-
<?php $_id = 'id_' . md5(microtime()) ?>
11+
<?php
12+
// md5() here is not for cryptographic use.
13+
// phpcs:ignore Magento2.Security.InsecureFunction
14+
$_id = 'id_' . md5(microtime())
15+
?>
1216
<input type="hidden"
1317
name="<?= $block->escapeHtmlAttr($block->getInputElementName()) ?>"
1418
value=""

app/code/Magento/Developer/Console/Command/DevTestsRunCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
105105
}
106106
$message = $dirName . '> ' . $command;
107107
$output->writeln(['', str_pad("---- {$message} ", 70, '-'), '']);
108+
// passthru() call have to be here.
109+
// phpcs:ignore Magento2.Security.InsecureFunction
108110
passthru($command, $returnVal);
109111
if ($returnVal) {
110112
$failures[] = $message;

app/code/Magento/Eav/Model/Entity/Attribute/Group.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public function beforeSave()
128128
$isReservedSystemName = in_array(strtolower($attributeGroupCode), $this->reservedSystemNames);
129129
if (empty($attributeGroupCode) || $isReservedSystemName) {
130130
// in the following code md5 is not used for security purposes
131+
// phpcs:ignore Magento2.Security.InsecureFunction
131132
$attributeGroupCode = md5(strtolower($groupName));
132133
}
133134
$this->setAttributeGroupCode($attributeGroupCode);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ public function changeEncryptionKey($key = null)
108108
}
109109

110110
if (null === $key) {
111+
// md5() here is not for cryptographic use. It used for generate encryption key itself
112+
// and do not encrypt any passwords
113+
// phpcs:ignore Magento2.Security.InsecureFunction
111114
$key = md5($this->random->getRandomString(ConfigOptionsListConstants::STORE_KEY_RANDOM_STRING_SIZE));
112115
}
113116
$this->encryptor->setNewKey($key);

app/code/Magento/Integration/Model/Message/RecreatedIntegration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public function isDisplayed()
8181
*/
8282
public function getIdentity()
8383
{
84+
// md5() here is not for cryptographic use.
85+
// phpcs:ignore Magento2.Security.InsecureFunction
8486
return md5('INTEGRATION_RECREATED');
8587
}
8688

app/code/Magento/Store/Model/StoresData.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public function __construct(
5656
*/
5757
public function getStoresData(string $runMode, string $scopeCode = null) : array
5858
{
59+
// md5() here is not for cryptographic use.
60+
// phpcs:ignore Magento2.Security.InsecureFunction
5961
$cacheKey = 'resolved_stores_' . md5($runMode . $scopeCode);
6062
$cacheData = $this->cache->load($cacheKey);
6163
if ($cacheData) {

app/code/Magento/Theme/Model/Design.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ public function loadChange($storeId, $date = null)
111111
$date = $this->_dateTime->formatDate($this->_localeDate->scopeTimeStamp($storeId), false);
112112
}
113113

114+
// md5() here is not for cryptographic use.
115+
// phpcs:ignore Magento2.Security.InsecureFunction
114116
$changeCacheId = 'design_change_' . md5($storeId . $date);
115117
$result = $this->_cacheManager->load($changeCacheId);
116118
if ($result === false) {

app/code/Magento/Ui/Model/Export/ConvertToCsv.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public function getCsvFile()
6565
{
6666
$component = $this->filter->getComponent();
6767

68+
// md5() here is not for cryptographic use.
69+
// phpcs:ignore Magento2.Security.InsecureFunction
6870
$name = md5(microtime());
6971
$file = 'export/'. $component->getName() . $name . '.csv';
7072

app/code/Magento/Ui/Model/Export/ConvertToXml.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ public function getXmlFile()
127127
{
128128
$component = $this->filter->getComponent();
129129

130+
// md5() here is not for cryptographic use.
131+
// phpcs:ignore Magento2.Security.InsecureFunction
130132
$name = md5(microtime());
131133
$file = 'export/'. $component->getName() . $name . '.xml';
132134

dev/tests/integration/framework/Magento/TestFramework/MessageQueue/PublisherConsumerController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ public function stopConsumers()
138138
{
139139
foreach ($this->consumers as $consumer) {
140140
foreach ($this->getConsumerProcessIds($consumer) as $consumerProcessId) {
141+
// exec() have to be here since this is test.
142+
// phpcs:ignore Magento2.Security.InsecureFunction
141143
exec("kill {$consumerProcessId}");
142144
}
143145
}
@@ -165,6 +167,8 @@ public function getConsumersProcessIds()
165167
*/
166168
private function getConsumerProcessIds($consumer)
167169
{
170+
// exec() have to be here since this is test.
171+
// phpcs:ignore Magento2.Security.InsecureFunction
168172
exec("ps ax | grep -v grep | grep '{$this->getConsumerStartCommand($consumer)}' | awk '{print $1}'", $output);
169173
return $output;
170174
}
@@ -232,6 +236,8 @@ public function startConsumers(): void
232236
{
233237
foreach ($this->consumers as $consumer) {
234238
if (!$this->getConsumerProcessIds($consumer)) {
239+
// exec() have to be here since this is test.
240+
// phpcs:ignore Magento2.Security.InsecureFunction
235241
exec("{$this->getConsumerStartCommand($consumer, true)} > /dev/null &");
236242
}
237243
sleep(5);

dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Compare/ListCompareTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ protected function setUp(): void
2828
->get(\Magento\Customer\Model\Session::class);
2929
$this->_visitor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
3030
->create(\Magento\Customer\Model\Visitor::class);
31+
// md5() used for generate unique session identifier for test purposes.
32+
// phpcs:ignore Magento2.Security.InsecureFunction
3133
$this->_visitor->setSessionId(md5(time()) . md5(microtime()))
3234
->setLastVisitAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT))
3335
->save();

dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ protected function getOptionValue()
182182
'title' => 'test.jpg',
183183
'quote_path' => $file,
184184
'order_path' => $file,
185-
'secret_key' => substr(md5(file_get_contents($filePath)), 0, 20),
185+
'secret_key' => substr(hash('sha256', file_get_contents($filePath)), 0, 20),
186186
];
187187
}
188188
}

dev/tests/integration/testsuite/Magento/Framework/Encryption/ModelTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public function testEncryptDecrypt2()
3333
{
3434
$encryptor = $this->_model;
3535

36+
// md5() here is not for cryptographic use just generate random string.
37+
// phpcs:ignore Magento2.Security.InsecureFunction
3638
$initial = md5(uniqid());
3739
$encrypted = $encryptor->encrypt($initial);
3840
$this->assertNotEquals($initial, $encrypted);
@@ -41,6 +43,8 @@ public function testEncryptDecrypt2()
4143

4244
public function testValidateKey()
4345
{
46+
// md5() have to be use here.
47+
// phpcs:ignore Magento2.Security.InsecureFunction
4448
$validKey = md5(uniqid());
4549
$this->_model->validateKey($validKey);
4650
}

dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ public function testOpenAndClose()
121121
*/
122122
public function testWriteReadDestroy()
123123
{
124+
// We have to use serialize here.
125+
// phpcs:ignore Magento2.Security.InsecureFunction
124126
$data = serialize($this->_sessionData[self::SESSION_NEW]);
125127
$this->_model->write(self::SESSION_ID, $data);
126128
$this->assertEquals($data, $this->_model->read(self::SESSION_ID));
127129

130+
// We have to use serialize here.
131+
// phpcs:ignore Magento2.Security.InsecureFunction
128132
$data = serialize($this->_sessionData[self::SESSION_EXISTS]);
129133
$this->_model->write(self::SESSION_ID, $data);
130134
$this->assertEquals($data, $this->_model->read(self::SESSION_ID));
@@ -151,6 +155,8 @@ public function testGc()
151155
*/
152156
public function testWriteEncoded()
153157
{
158+
// We have to use serialize here.
159+
// phpcs:ignore Magento2.Security.InsecureFunction
154160
$data = serialize($this->_sessionData[self::SESSION_NEW]);
155161
$this->_model->write(self::SESSION_ID, $data);
156162

@@ -179,6 +185,7 @@ public function readEncodedDataProvider()
179185
{
180186
// we can't use object data as a fixture because not encoded serialized object
181187
// might cause DB adapter fatal error, so we have to use array as a fixture
188+
// phpcs:ignore Magento2.Security.InsecureFunction
182189
$sessionData = serialize($this->_sourceData[self::SESSION_NEW]);
183190
return [
184191
'session_encoded' => ['$sessionData' => base64_encode($sessionData)],
@@ -201,6 +208,8 @@ public function testReadEncoded($sessionData)
201208
$this->_connection->insertOnDuplicate($this->_sessionTable, $sessionRecord, [self::COLUMN_SESSION_DATA]);
202209

203210
$sessionData = $this->_model->read(self::SESSION_ID);
211+
// We have to use unserialize here.
212+
// phpcs:ignore Magento2.Security.InsecureFunction
204213
$this->assertEquals($this->_sourceData[self::SESSION_NEW], unserialize($sessionData));
205214
}
206215
}

dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/IntegrationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ protected function setUp(): void
2626
$this->consumer = $objectManager->create(\Magento\Integration\Model\Oauth\Consumer::class);
2727
$this->consumer->setData(
2828
[
29+
// md5() here just to generate unique string
30+
// phpcs:disable Magento2.Security.InsecureFunction
2931
'key' => md5(uniqid()),
3032
'secret' => md5(uniqid()),
33+
// phpcs:enable
3134
'callback_url' => 'http://example.com/callback',
3235
'rejected_callback_url' => 'http://example.com/rejectedCallback'
3336
]

dev/tests/integration/testsuite/Magento/MessageQueue/Model/Plugin/ResourceModel/LockTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public function testLockClearedByMaintenanceModeOff()
4848
{
4949
/** @var $maintenanceMode \Magento\Framework\App\MaintenanceMode */
5050
$maintenanceMode = $this->objectManager->get(\Magento\Framework\App\MaintenanceMode::class);
51+
// md5() here is not for cryptographic use.
52+
// phpcs:ignore Magento2.Security.InsecureFunction
5153
$code = md5('consumer.name-1');
5254
$this->lock->setMessageCode($code);
5355
$this->writer->saveLock($this->lock);

dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public function testSendPerSubscriber()
6161
*/
6262
public function testSendPerSubscriberProblem()
6363
{
64+
// md5 used here only for random string generation for test purposes. No cryptographic use.
65+
// phpcs:ignore Magento2.Security.InsecureFunction
6466
$errorMsg = md5(microtime());
6567

6668
\Magento\TestFramework\Helper\Bootstrap::getInstance()

dev/tests/integration/testsuite/Magento/Test/Integrity/DatabaseTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public function testDuplicateKeys()
2424
$command = $checkerPath . ' -d ' . $db->getSchema()
2525
. ' h=' . $db->getHost()['db-host'] . ',u=' . $db->getUser() . ',p=' . $db->getPassword();
2626

27+
// exec() have to be here since this is test.
28+
// phpcs:ignore Magento2.Security.InsecureFunction
2729
exec($command, $output, $exitCode);
2830
$this->assertEquals(0, $exitCode);
2931
$output = implode(PHP_EOL, $output);

dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public function setBlackList(array $blackList)
5454
*/
5555
public function canRun()
5656
{
57+
// exec() have to be here since this is test.
58+
// phpcs:ignore Magento2.Security.InsecureFunction
5759
exec($this->getCommand() . ' --version', $output, $exitCode);
5860
return $exitCode === 0;
5961
}
@@ -86,6 +88,8 @@ public function run(array $whiteList)
8688
$command = $this->getCommand() . ' --log-pmd ' . escapeshellarg($this->reportFile)
8789
. ' --names-exclude ' . join(',', $blacklistedFileNames) . ' --min-lines 13 ' . join(' ', $blacklistedDirs)
8890
. ' ' . implode(' ', $whiteList);
91+
// exec() have to be here since this is test.
92+
// phpcs:ignore Magento2.Security.InsecureFunction
8993
exec($command, $output, $exitCode);
9094

9195
return !(bool)$exitCode;

dev/tests/static/get_github_changes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ private function call($command)
485485
escapeshellarg($this->workTree)
486486
);
487487
$tmp = sprintf('%s %s', $gitCmd, $command);
488+
// exec() have to be here since this is test.
489+
// phpcs:ignore Magento2.Security.InsecureFunction
488490
exec($tmp, $output);
489491
return $output;
490492
}

lib/internal/Magento/Framework/Api/ImageProcessor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ public function processImageContent($entityType, $imageContent)
145145
$fileContent = @base64_decode($imageContent->getBase64EncodedData(), true);
146146
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
147147
$fileName = $this->getFileName($imageContent);
148+
// md5() here is not for cryptographic use.
149+
// phpcs:ignore Magento2.Security.InsecureFunction
148150
$tmpFileName = substr(md5(rand()), 0, 7) . '.' . $fileName;
149151
$tmpDirectory->writeFile($tmpFileName, $fileContent);
150152

lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ public function create(array $options)
139139
if (empty($idPrefix)) {
140140
$configDirPath = $this->_filesystem->getDirectoryRead(DirectoryList::CONFIG)->getAbsolutePath();
141141
$idPrefix =
142+
// md5() here is not for cryptographic use.
143+
// phpcs:ignore Magento2.Security.InsecureFunction
142144
substr(md5($configDirPath), 0, 3) . '_';
143145
}
144146
$options['frontend_options']['cache_id_prefix'] = $idPrefix;

lib/internal/Magento/Framework/Cache/Backend/RemoteSynchronizedCache.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
248248
$this->unlock($id);
249249
}
250250

251+
// mt_rand() here is not for cryptographic use.
252+
// phpcs:ignore Magento2.Security.InsecureFunction
251253
if (!mt_rand(0, 100) && $this->checkIfLocalCacheSpaceExceeded()) {
252254
$this->local->clean();
253255
}

lib/internal/Magento/Framework/DB/ExpressionConverter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public static function shortenEntityName($entityName, $prefix)
102102
if (strlen($entityName) > self::MYSQL_IDENTIFIER_LEN) {
103103
$shortName = ExpressionConverter::shortName($entityName);
104104
if (strlen($shortName) > self::MYSQL_IDENTIFIER_LEN) {
105+
// md5() here is not for cryptographic use.
106+
// phpcs:ignore Magento2.Security.InsecureFunction
105107
$hash = md5($entityName);
106108
if (strlen($prefix . $hash) > self::MYSQL_IDENTIFIER_LEN) {
107109
$entityName = self::trimHash($hash, $prefix, self::MYSQL_IDENTIFIER_LEN);

lib/internal/Magento/Framework/Data/Collection/Db/FetchStrategy/Cache.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public function fetchAll(Select $select, array $bindParams = [])
9999
*/
100100
protected function _getSelectCacheId($select)
101101
{
102+
// md5() here is not for cryptographic use.
103+
// phpcs:ignore Magento2.Security.InsecureFunction
102104
return $this->_cacheIdPrefix . md5((string)$select);
103105
}
104106
}

lib/internal/Magento/Framework/Filesystem/Io/Ftp.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public function ls($grep = null)
316316
$ls = @ftp_nlist($this->_conn, '.') ?: [];
317317

318318
$list = [];
319-
319+
320320
foreach ($ls as $file) {
321321
$list[] = ['text' => $file, 'id' => $this->pwd() . '/' . $file];
322322
}
@@ -331,6 +331,8 @@ public function ls($grep = null)
331331
protected function _tmpFilename($new = false)
332332
{
333333
if ($new || !$this->_tmpFilename) {
334+
// md5() here is not for cryptographic use.
335+
// phpcs:ignore Magento2.Security.InsecureFunction
334336
$this->_tmpFilename = tempnam(md5(uniqid(rand(), true)), '');
335337
}
336338
return $this->_tmpFilename;

0 commit comments

Comments
 (0)