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

SNYK: Sanitize and bind Meta-Services dependency queries #11554

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 @@ -114,19 +114,23 @@ function multipleMetaServiceDependencyInDB($dependencies = array(), $nbrDup = ar
$query = "SELECT DISTINCT meta_service_meta_id FROM dependency_metaserviceParent_relation " .
"WHERE dependency_dep_id = '" . $key . "'";
$dbResult = $pearDB->query($query);
$statement = $pearDB->prepare("INSERT INTO dependency_metaserviceParent_relation " .
"VALUES (:maxId, :metaId)");
while ($ms = $dbResult->fetch()) {
$query = "INSERT INTO dependency_metaserviceParent_relation " .
"VALUES ('" . $maxId["MAX(dep_id)"] . "', '" . $ms["meta_service_meta_id"] . "')";
$pearDB->query($query);
$statement->bindValue(':maxId', (int) $maxId["MAX(dep_id)"], \PDO::PARAM_INT);
$statement->bindValue(':metaId', (int) $ms["meta_service_meta_id"], \PDO::PARAM_INT);
$statement->execute();
}
$dbResult->closeCursor();
$query = "SELECT DISTINCT meta_service_meta_id FROM dependency_metaserviceChild_relation " .
"WHERE dependency_dep_id = '" . $key . "'";
$dbResult = $pearDB->query($query);
$childStatement = $pearDB->prepare("INSERT INTO dependency_metaserviceChild_relation " .
"VALUES (:maxId, :metaId)");
while ($ms = $dbResult->fetch()) {
$query = "INSERT INTO dependency_metaserviceChild_relation VALUES ('" .
$maxId["MAX(dep_id)"] . "', '" . $ms["meta_service_meta_id"] . "')";
$pearDB->query($query);
$childStatement->bindValue(':maxId', (int) $maxId["MAX(dep_id)"], \PDO::PARAM_INT);
$childStatement->bindValue(':metaId', (int) $ms["meta_service_meta_id"], \PDO::PARAM_INT);
$childStatement->execute();
}
$dbResult->closeCursor();
}
Expand Down