File tree 3 files changed +14
-20
lines changed
3 files changed +14
-20
lines changed Original file line number Diff line number Diff line change 12
12
*/
13
13
class InsecureFunctionSniff extends ForbiddenFunctionsSniff
14
14
{
15
- /**
16
- * If true, an error will be thrown; otherwise a warning.
17
- *
18
- * @var boolean
19
- */
20
- public $ error = false ;
21
-
22
15
/**
23
16
* List of patterns for forbidden functions.
24
17
*
@@ -38,7 +31,7 @@ class InsecureFunctionSniff extends ForbiddenFunctionsSniff
38
31
'system ' => null ,
39
32
'unserialize ' => '\Magento\Framework\Serialize\SerializerInterface::unserialize ' ,
40
33
'srand ' => null ,
41
- 'mt_srand ' => null ,
34
+ 'mt_srand ' => null ,
42
35
'mt_rand ' => 'random_int ' ,
43
36
];
44
37
}
Original file line number Diff line number Diff line change 3
3
* Copyright © Magento. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
6
7
namespace Magento2 \Tests \Security ;
7
8
8
9
use PHP_CodeSniffer \Tests \Standards \AbstractSniffUnitTest ;
@@ -16,14 +17,6 @@ class InsecureFunctionUnitTest extends AbstractSniffUnitTest
16
17
* @inheritdoc
17
18
*/
18
19
public function getErrorList ()
19
- {
20
- return [];
21
- }
22
-
23
- /**
24
- * @inheritdoc
25
- */
26
- public function getWarningList ()
27
20
{
28
21
return [
29
22
3 => 1 ,
@@ -43,4 +36,12 @@ public function getWarningList()
43
36
31 => 1 ,
44
37
];
45
38
}
39
+
40
+ /**
41
+ * @inheritdoc
42
+ */
43
+ public function getWarningList ()
44
+ {
45
+ return [];
46
+ }
46
47
}
Original file line number Diff line number Diff line change 65
65
<exclude-pattern >*/Test/*</exclude-pattern >
66
66
<exclude-pattern >*Test.php</exclude-pattern >
67
67
</rule >
68
+ <rule ref =" Magento2.Security.InsecureFunction" >
69
+ <severity >10</severity >
70
+ <type >error</type >
71
+ </rule >
68
72
<rule ref =" Magento2.Security.LanguageConstruct" >
69
73
<severity >10</severity >
70
74
<type >error</type >
104
108
<severity >9</severity >
105
109
<type >warning</type >
106
110
</rule >
107
- <rule ref =" Magento2.Security.InsecureFunction" >
108
- <severity >9</severity >
109
- <type >warning</type >
110
- </rule >
111
111
<rule ref =" Magento2.Security.Superglobal.SuperglobalUsageWarning" >
112
112
<severity >9</severity >
113
113
<type >warning</type >
You can’t perform that action at this time.
0 commit comments