Skip to content

Commit 180c715

Browse files
authored
Merge pull request #104 from magento/insecure-sev-10
REPO-209: [EQP] Increase the severity level to 10 for insecure functions
2 parents 924af14 + 4498f00 commit 180c715

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

Magento2/Sniffs/Security/InsecureFunctionSniff.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
*/
1313
class InsecureFunctionSniff extends ForbiddenFunctionsSniff
1414
{
15-
/**
16-
* If true, an error will be thrown; otherwise a warning.
17-
*
18-
* @var boolean
19-
*/
20-
public $error = false;
21-
2215
/**
2316
* List of patterns for forbidden functions.
2417
*
@@ -38,7 +31,7 @@ class InsecureFunctionSniff extends ForbiddenFunctionsSniff
3831
'system' => null,
3932
'unserialize' => '\Magento\Framework\Serialize\SerializerInterface::unserialize',
4033
'srand' => null,
41-
'mt_srand'=> null,
34+
'mt_srand' => null,
4235
'mt_rand' => 'random_int',
4336
];
4437
}

Magento2/Tests/Security/InsecureFunctionUnitTest.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento2\Tests\Security;
78

89
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
@@ -16,14 +17,6 @@ class InsecureFunctionUnitTest extends AbstractSniffUnitTest
1617
* @inheritdoc
1718
*/
1819
public function getErrorList()
19-
{
20-
return [];
21-
}
22-
23-
/**
24-
* @inheritdoc
25-
*/
26-
public function getWarningList()
2720
{
2821
return [
2922
3 => 1,
@@ -43,4 +36,12 @@ public function getWarningList()
4336
31 => 1,
4437
];
4538
}
39+
40+
/**
41+
* @inheritdoc
42+
*/
43+
public function getWarningList()
44+
{
45+
return [];
46+
}
4647
}

Magento2/ruleset.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
<exclude-pattern>*/Test/*</exclude-pattern>
6666
<exclude-pattern>*Test.php</exclude-pattern>
6767
</rule>
68+
<rule ref="Magento2.Security.InsecureFunction">
69+
<severity>10</severity>
70+
<type>error</type>
71+
</rule>
6872
<rule ref="Magento2.Security.LanguageConstruct">
6973
<severity>10</severity>
7074
<type>error</type>
@@ -104,10 +108,6 @@
104108
<severity>9</severity>
105109
<type>warning</type>
106110
</rule>
107-
<rule ref="Magento2.Security.InsecureFunction">
108-
<severity>9</severity>
109-
<type>warning</type>
110-
</rule>
111111
<rule ref="Magento2.Security.Superglobal.SuperglobalUsageWarning">
112112
<severity>9</severity>
113113
<type>warning</type>

0 commit comments

Comments
 (0)