From 669a620edff1a975af5970b289a816e9204e6cf2 Mon Sep 17 00:00:00 2001 From: Laurent Calvet Date: Wed, 3 Oct 2018 15:23:16 +0200 Subject: [PATCH] fix(acl access groups): Fix XSS vulnerability (#6710) FIX: MON-2879 Fix XSS on Menu access list link Secure all name against XSS vulnerability --- .../accessLists/groupsACL/formGroupConfig.php | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/www/include/options/accessLists/groupsACL/formGroupConfig.php b/www/include/options/accessLists/groupsACL/formGroupConfig.php index daf7dab98db..07744b20693 100644 --- a/www/include/options/accessLists/groupsACL/formGroupConfig.php +++ b/www/include/options/accessLists/groupsACL/formGroupConfig.php @@ -49,7 +49,7 @@ /* * Set base value */ - $group = array_map("myDecode", $DBRESULT->fetchRow()); + $group = array_map("CentreonUtils::escapeAll", $DBRESULT->fetchRow()); /* * Set Contact Childs @@ -128,7 +128,10 @@ . "ORDER BY contact_name"; $DBRESULT = $pearDB->query($query); while ($contact = $DBRESULT->fetchRow()) { - $contacts[$contact["contact_id"]] = $contact["contact_name"]; + $contacts[$contact["contact_id"]] = CentreonUtils::escapeAll( + $contact["contact_name"], + CentreonUtils::ESCAPE_ALL + ); } unset($contact); $DBRESULT->closeCursor(); @@ -140,7 +143,10 @@ $menus = array(); $DBRESULT = $pearDB->query("SELECT acl_topo_id, acl_topo_name FROM acl_topology ORDER BY acl_topo_name"); while ($topo = $DBRESULT->fetchRow()) { - $menus[$topo["acl_topo_id"]] = $topo["acl_topo_name"]; + $menus[$topo["acl_topo_id"]] = CentreonUtils::escapeAll( + $topo["acl_topo_name"], + CentreonUtils::ESCAPE_ALL + ); } unset($topo); $DBRESULT->closeCursor(); @@ -149,7 +155,10 @@ $action = array(); $DBRESULT = $pearDB->query("SELECT acl_action_id, acl_action_name FROM acl_actions ORDER BY acl_action_name"); while ($data = $DBRESULT->fetchRow()) { - $action[$data["acl_action_id"]] = $data["acl_action_name"]; + $action[$data["acl_action_id"]] = CentreonUtils::escapeAll( + $data["acl_action_name"], + CentreonUtils::ESCAPE_ALL + ); } unset($data); $DBRESULT->closeCursor(); @@ -162,7 +171,10 @@ . 'ORDER BY acl_res_name'; $DBRESULT = $pearDB->query($query); while ($res = $DBRESULT->fetchRow()) { - $resources[$res["acl_res_id"]] = $res["acl_res_name"]; + $resources[$res["acl_res_id"]] = CentreonUtils::escapeAll( + $res["acl_res_name"], + CentreonUtils::ESCAPE_ALL + ); } unset($res); $DBRESULT->closeCursor();