A live bird collage card for your Home Assistant dashboard.
prevent directory traversal
frederikec134fa2e362
diff --git a/scripts/play.php b/scripts/play.phpindex 5e2bfc71..0ec87507 100644--- a/scripts/play.php+++ b/scripts/play.php@@ -15,6 +15,10 @@ $db->busyTimeout(1000);if(isset($_GET['deletefile'])) {ensure_authenticated('You must be authenticated to delete files.');+ if (preg_match('~^.*(\.\.\/).+$~', $_GET['deletefile'])) {+ echo "Error";+ die();+ }$db_writable = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_READWRITE);$db->busyTimeout(1000);$statement1 = $db_writable->prepare('DELETE FROM detections WHERE File_Name = :file_name LIMIT 1');