Skip to content

Commit bbbbe68

Browse files
author
Joan He
authored
Merge pull request #4473 from magento-arcticfoxes/MC-17310
[arcticfoxes] Bug Fixes
2 parents fdf66c6 + 4271def commit bbbbe68

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/code/Magento/Rule/Model/Condition/Sql/Builder.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,11 @@ protected function _getMappedSqlCondition(AbstractCondition $condition, $value =
140140
{
141141
$argument = $condition->getMappedSqlField();
142142

143-
// If rule hasn't valid argument - create negative expression to prevent incorrect rule behavior.
143+
// If rule hasn't valid argument - prevent incorrect rule behavior.
144144
if (empty($argument)) {
145145
return $this->_expressionFactory->create(['expression' => '1 = -1']);
146+
} elseif (preg_match('/[^a-z0-9\-_\.\`]/i', $argument) > 0) {
147+
throw new \Magento\Framework\Exception\LocalizedException(__('Invalid field'));
146148
}
147149

148150
$conditionOperator = $condition->getOperatorForValidate();
@@ -183,6 +185,7 @@ protected function _getMappedSqlCondition(AbstractCondition $condition, $value =
183185
* @param bool $isDefaultStoreUsed
184186
* @return string
185187
* @SuppressWarnings(PHPMD.NPathComplexity)
188+
* @throws \Magento\Framework\Exception\LocalizedException
186189
*/
187190
protected function _getMappedSqlCombination(Combine $combine, $value = '', $isDefaultStoreUsed = true)
188191
{

0 commit comments

Comments
 (0)