mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°7514 - hardening code
(cherry picked from commit b8b9423aa85c65b25f7fb3d9c5ba0933317474d7)
This commit is contained in:
@@ -35,7 +35,8 @@ $(function()
|
|||||||
me.element.addClass('has-error');
|
me.element.addClass('has-error');
|
||||||
for(var i in oResult.error_messages)
|
for(var i in oResult.error_messages)
|
||||||
{
|
{
|
||||||
me.element.find('.help-block').append($('<p>' + oResult.error_messages[i] + '</p>'));
|
// transform error message in pure text to avoid XSS
|
||||||
|
me.element.find('.help-block').append($('<p>').text(oResult.error_messages[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -252,7 +252,8 @@ $(function()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oHelpBlock.append($('<p>' + sMessageContent + '</p>'));
|
// transform error message in pure text (to avoid XSS)
|
||||||
|
oHelpBlock.append($('<p>').text(sMessageContent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ class MultipleChoicesValidator extends AbstractValidator
|
|||||||
private function CheckValueAgainstChoices(string $sValue, array &$aErrorMessages): void
|
private function CheckValueAgainstChoices(string $sValue, array &$aErrorMessages): void
|
||||||
{
|
{
|
||||||
if (false === array_key_exists($sValue, $this->aChoices)) {
|
if (false === array_key_exists($sValue, $this->aChoices)) {
|
||||||
$sValue = utils::HtmlEntities($sValue);
|
|
||||||
$aErrorMessages[] = "Value ({$sValue}) is not part of the field possible values list";
|
$aErrorMessages[] = "Value ({$sValue}) is not part of the field possible values list";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class SelectObjectValidator extends AbstractValidator
|
|||||||
$iObjectsCount = $oSetForExistingCurrentValue->CountWithLimit(1);
|
$iObjectsCount = $oSetForExistingCurrentValue->CountWithLimit(1);
|
||||||
|
|
||||||
if ($iObjectsCount === 0) {
|
if ($iObjectsCount === 0) {
|
||||||
$value = utils::HtmlEntities($value);
|
|
||||||
return ["Value $value does not match the corresponding filter set"];
|
return ["Value $value does not match the corresponding filter set"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user