-
Notifications
You must be signed in to change notification settings - Fork 240
fix(admin): add SQL and XSS protection of Administration Logs page #7038
Conversation
@@ -85,7 +85,9 @@ function searchUserName($user_name) | |||
$contactList = array(); | |||
$DBRES = $pearDB->query("SELECT contact_id, contact_name, contact_alias FROM contact"); | |||
while ($row = $DBRES->fetchRow()) { | |||
$contactList[$row["contact_id"]] = $row["contact_name"] . " (".$row["contact_alias"].")"; | |||
$contactList[$row["contact_id"]] = CentreonUtils::escapeSecure( | |||
$row["contact_name"] . " (".$row["contact_alias"].")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space around dot
@@ -188,10 +190,13 @@ function searchUserName($user_name) | |||
} else { | |||
$query .= " AND "; | |||
} | |||
$query .= " object_type = '".$objects_type_tab[$otype]."' "; | |||
$query .= " object_type = '".$pearDB->escape($objects_type_tab[$otype])."' "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space around dot
$query .= " ORDER BY action_log_date DESC LIMIT ".$num * $limit.", ".$limit; | ||
|
||
$query .= " ORDER BY action_log_date DESC LIMIT " | ||
. (int)($num * $limit) . ", ". (int) $limit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space around dot
Resolve MON-3227
@@ -52,7 +52,7 @@ function searchUserName($user_name) | |||
if ($str != "") { | |||
$str .= ", "; | |||
} | |||
$str .= "'" . $row['contact_id'] . "'"; | |||
$str .= "'" . $pearDB->escape($row['contact_id']) . "'"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you want to escape an integer value ?
In the centreon database, the structure of 'contact' indicates that contact_id is an integer.
When you are supposed to work with an integer value, please use the following syntax (int) $row['contact_id']
.
Resolve MON-3227
Resolve MON-3227