Skip to content

Commit

Permalink
Internal: Fix regression introduced during XSS protection on tag sets
Browse files Browse the repository at this point in the history
  • Loading branch information
Molkobain committed Dec 19, 2018
1 parent 44671a5 commit 3219957
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/search/search_form_criteria_enum.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ $(function()
// - Make a jQuery element for a list item
_makeListItemElement: function(sLabel, sValue, bInitChecked, bInitHidden)
{
var sEscapedLabel = $('<div />').text(sLabel).html();
var sEscapedLabel = sLabel; // Note: We don't escape this anymore as there is an issue with AttributeExternalKey being already escaped. This will be put back in iTop 2.7 with the AttributeDefinition::GetAllowedValues() refactoring. $('<div />').text(sLabel).html();
var oItemElem = $('<div></div>')
.addClass('sfc_opc_mc_item')
.attr('data-value-code', sValue)
Expand Down
11 changes: 11 additions & 0 deletions sources/application/search/searchform.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use AttributeExternalField;
use AttributeFriendlyName;
use AttributeSubItem;
use AttributeTagSet;
use CMDBObjectSet;
use Combodo\iTop\Application\Search\CriterionConversion\CriterionToSearchForm;
use CoreException;
Expand Down Expand Up @@ -467,6 +468,16 @@ public static function GetFieldAllowedValues($oAttrDef)
return array('values' => $aAllowedValues);
}
}
elseif ($oAttrDef instanceof AttributeTagSet)
{
$aAllowedValues = array();
foreach($oAttrDef->GetAllowedValues() as $sCode => $sRawValue)
{
$aAllowedValues[$sCode] = utils::HtmlEntities($sRawValue);
}

return array('values' => $aAllowedValues);
}
else
{
if (method_exists($oAttrDef, 'GetAllowedValuesAsObjectSet'))
Expand Down

0 comments on commit 3219957

Please sign in to comment.