NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Ensure that a user must provide an image in an expected location (#20491)
Nicolas Mowen4d582062fba0
diff --git a/frigate/api/export.py b/frigate/api/export.pyindex 160434c687..44ec05c15b 100644--- a/frigate/api/export.py+++ b/frigate/api/export.py@@ -8,6 +8,7 @@ from pathlib import Pathimport psutilfrom fastapi import APIRouter, Depends, Requestfrom fastapi.responses import JSONResponse+from pathvalidate import sanitize_filepathfrom peewee import DoesNotExistfrom playhouse.shortcuts import model_to_dict@@ -15,7 +16,7 @@ from frigate.api.auth import require_rolefrom frigate.api.defs.request.export_recordings_body import ExportRecordingsBodyfrom frigate.api.defs.request.export_rename_body import ExportRenameBodyfrom frigate.api.defs.tags import Tags-from frigate.const import EXPORT_DIR+from frigate.const import CLIPS_DIR, EXPORT_DIRfrom frigate.models import Export, Previews, Recordingsfrom frigate.record.export import (PlaybackFactorEnum,@@ -54,7 +55,14 @@ def export_recording(playback_factor = body.playbackplayback_source = body.sourcefriendly_name = body.name- existing_image = body.image_path+ existing_image = sanitize_filepath(body.image_path) if body.image_path else None++ # Ensure that existing_image is a valid path+ if existing_image and not existing_image.startswith(CLIPS_DIR):+ return JSONResponse(+ content=({"success": False, "message": "Invalid image path"}),+ status_code=400,+ )if playback_source == "recordings":recordings_count = (