Skip to content

Commit 46756f3

Browse files
RizwanRizwan
authored andcommitted
AC-6049: Filtering inputs handler in page_cache/block controller
* Updated as per review
1 parent d8bf1c6 commit 46756f3

File tree

1 file changed

+7
-2
lines changed
  • app/code/Magento/PageCache/Controller

1 file changed

+7
-2
lines changed

app/code/Magento/PageCache/Controller/Block.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ abstract class Block extends \Magento\Framework\App\Action\Action
4747
*/
4848
private $regexValidatorFactory;
4949

50+
/**
51+
* Validation pattern for handles array
52+
*/
53+
public const VALIDATION_RULE_PATTERN = '/^[a-z]+[a-z0-9_]*$/i';
54+
5055
/**
5156
* @param \Magento\Framework\App\Action\Context $context
5257
* @param \Magento\Framework\Translate\InlineInterface $translateInline
@@ -113,8 +118,8 @@ protected function _getBlocks()
113118
* @param $handles array
114119
* @return bool
115120
*/
116-
private function validateHandleParam($handles) {
117-
$validator = $this->regexValidatorFactory->create(['pattern' => '/^[a-z]+[a-z0-9_]*$/i']);
121+
private function validateHandleParam($handles): bool {
122+
$validator = $this->regexValidatorFactory->create(['pattern' => self::VALIDATION_RULE_PATTERN]);
118123
foreach ($handles as $handle) {
119124
if (!$validator->isValid($handle)) {
120125
return false;

0 commit comments

Comments
 (0)