Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

[Snyk]Sanitized and bound queries #11413

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,12 @@ function multipleHostGroupDependencyInDB($dependencies = array(), $nbrDup = arra
"WHERE dependency_dep_id = '" . $key . "'";
$dbResult = $pearDB->query($query);
$fields["dep_hgParents"] = "";
$query = "INSERT INTO dependency_hostgroupParent_relation VALUES (:max_id, :hg_id)";
$statement = $pearDB->prepare($query);
while ($hg = $dbResult->fetch()) {
$query = "INSERT INTO dependency_hostgroupParent_relation VALUES ('" .
$maxId["MAX(dep_id)"] . "', '" . $hg["hostgroup_hg_id"] . "')";
$pearDB->query($query);
$statement->bindValue(':max_id', (int) $maxId["MAX(dep_id)"], \PDO::PARAM_INT);
$statement->bindValue(':hg_id', (int) $hg["hostgroup_hg_id"], \PDO::PARAM_INT);
$statement->execute();
$fields["dep_hgParents"] .= $hg["hostgroup_hg_id"] . ",";
}
$fields["dep_hgParents"] = trim($fields["dep_hgParents"], ",");
Expand All @@ -136,10 +138,12 @@ function multipleHostGroupDependencyInDB($dependencies = array(), $nbrDup = arra
"WHERE dependency_dep_id = '" . $key . "'";
$dbResult = $pearDB->query($query);
$fields["dep_hgChilds"] = "";
$query = "INSERT INTO dependency_hostgroupChild_relation VALUES (:max_id, :hg_id)";
$statement = $pearDB->prepare($query);
while ($hg = $dbResult->fetch()) {
$query = "INSERT INTO dependency_hostgroupChild_relation VALUES ('" .
$maxId["MAX(dep_id)"] . "', '" . $hg["hostgroup_hg_id"] . "')";
$pearDB->query($query);
$statement->bindValue(':max_id', (int) $maxId["MAX(dep_id)"], \PDO::PARAM_INT);
$statement->bindValue(':hg_id', (int) $hg["hostgroup_hg_id"], \PDO::PARAM_INT);
$statement->execute();
$fields["dep_hgChilds"] .= $hg["hostgroup_hg_id"] . ",";
}
$fields["dep_hgChilds"] = trim($fields["dep_hgChilds"], ",");
Expand Down