Skip to content

Commit 5957a45

Browse files
committed
AC-9509: Scheduled operation improvements.
1 parent 40c9ddb commit 5957a45

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ public function __construct(?PurifierInterface $purifier = null)
5050
'/<\?\s*?(php|=).*>/Uis',
5151
//base64 usage
5252
'/src=[^<]*base64[^<]*(?=\/*\>)/Uis',
53-
//command line injections
54-
'/[|$`;!&]/',
5553
];
5654

5755
/**

lib/internal/Magento/Framework/Filter/Test/Unit/Input/MaliciousCodeTest.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ public function testFilter($input, $expectedOutput)
5151
{
5252
$this->purifier->expects(self::atLeastOnce())
5353
->method('purify')
54-
->will(
55-
$this->returnCallback(function ($arg) {
54+
->willReturnCallback(
55+
function ($arg) {
5656
return $arg;
57-
})
57+
}
5858
);
5959
self::assertEquals($expectedOutput, $this->filter->filter($input));
6060
}
@@ -135,7 +135,7 @@ public function filterDataProvider()
135135
],
136136
'Nested malicious tags' => [
137137
'<scri<script>pt>alert(1);</scri<script>pt>',
138-
'alert(1)',
138+
'alert(1);',
139139
],
140140
'Nested scripts' => [
141141
'<?php echo "test" ?>',
@@ -149,10 +149,6 @@ public function filterDataProvider()
149149
'<?=$test?>',
150150
'',
151151
],
152-
'Commandline injections' => [
153-
'ping -c3 www.example.com && links www.sample.com',
154-
'ping -c3 www.example.com links www.sample.com',
155-
],
156152
'Null Value' => [null, ''],
157153
];
158154
}
@@ -166,7 +162,11 @@ public function testAddExpression()
166162

167163
$this->purifier->expects(self::atLeastOnce())
168164
->method('purify')
169-
->willReturn('Custom malicious tag is removed customMalicious');
165+
->willReturnCallback(
166+
function ($arg) {
167+
return $arg;
168+
}
169+
);
170170

171171
$this->filter->addExpression($customExpression);
172172
$this->assertEquals(
@@ -188,7 +188,11 @@ public function testSetExpression()
188188

189189
$this->purifier->expects(self::atLeastOnce())
190190
->method('purify')
191-
->willReturn("Custom \tmalicious tag\t\t is removed customMalicious");
191+
->willReturnCallback(
192+
function ($arg) {
193+
return $arg;
194+
}
195+
);
192196

193197
$this->filter->setExpressions([$customExpression]);
194198
$this->assertEquals(

0 commit comments

Comments
 (0)