fix: add serverside check against endless loops

This commit is contained in:
Peace 2023-02-01 20:16:56 +01:00
parent 66573934f6
commit 9286dcb6ce
No known key found for this signature in database
GPG Key ID: 0EF6B46E172B739F

View File

@ -674,6 +674,14 @@ let needSetup = false;
throw new Error("Permission denied.");
}
// Check if Parent is Decendant (would cause endless loop)
if (monitor.parent !== null) {
const childIDs = await Monitor.getAllChildrenIDs(monitor.id);
if (childIDs.includes(monitor.parent)) {
throw new Error("Invalid Monitor Group");
}
}
// Reset Prometheus labels
server.monitorList[monitor.id]?.prometheus()?.remove();