diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index f848a09..e43f53c 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -56,7 +56,10 @@ function hasAllowedImportVideoExtension(filePath: string): boolean { return ALLOWED_IMPORT_VIDEO_EXTENSIONS.has(path.extname(filePath).toLowerCase()); } -async function approveReadableVideoPath(filePath?: string | null): Promise { +async function approveReadableVideoPath( + filePath?: string | null, + trustedDirs?: string[], +): Promise { const normalizedPath = normalizeVideoSourcePath(filePath); if (!normalizedPath) { return null; @@ -70,6 +73,17 @@ async function approveReadableVideoPath(filePath?: string | null): Promise isPathWithinDir(resolved, dir)); + if (!withinTrusted) { + return null; + } + } + try { const stats = await fs.stat(normalizedPath); if (!stats.isFile()) { @@ -103,7 +117,10 @@ function resolveRecordingOutputPath(fileName: string): string { return path.join(RECORDINGS_DIR, parsedPath.base); } -async function getApprovedProjectSession(project: unknown): Promise { +async function getApprovedProjectSession( + project: unknown, + projectFilePath?: string, +): Promise { if (!project || typeof project !== "object") { return null; } @@ -121,13 +138,20 @@ async function getApprovedProjectSession(project: unknown): Promise