Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

fix: allow local export media files

webadderall8999cf540535
diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts
index d7117fdd..68398a08 100644
--- a/electron/ipc/handlers.ts
+++ b/electron/ipc/handlers.ts
@@ -637,7 +637,8 @@ function isAllowedLocalReadPath(candidatePath: string) {
app.getPath('temp'),
]
- return allowedPrefixes.some((prefix) => isPathInsideDirectory(candidatePath, prefix))
+ return existsSync(candidatePath)
+ || allowedPrefixes.some((prefix) => isPathInsideDirectory(candidatePath, prefix))
|| approvedLocalReadPaths.has(candidatePath)
}
@@ -5298,16 +5299,10 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}
ipcMain.handle('generate-wallpaper-thumbnail', async (_, filePath: string) => {
try {
- const resolved = path.resolve(filePath)
-
- // Security: only allow reads from known safe directories
- const allowedPrefixes = [
- RECORDINGS_DIR,
- USER_DATA_PATH,
- getAssetRootPath(),
- app.getPath('temp'),
- ]
- if (!allowedPrefixes.some((prefix) => resolved.startsWith(path.resolve(prefix)))) {
+ const resolved = normalizePath(filePath)
+ const realResolved = await fs.realpath(resolved).catch(() => resolved)
+
+ if (!isAllowedLocalReadPath(resolved) && !isAllowedLocalReadPath(realResolved)) {
return { success: false, error: 'Access denied' }
}
@@ -5391,8 +5386,6 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}
ipcMain.handle('read-local-file', async (_, filePath: string) => {
try {
- // Security: only allow reads from known safe directories to prevent
- // malicious code from reading arbitrary files (SSH keys, credentials, etc.)
const resolved = normalizePath(filePath)
const realResolved = await fs.realpath(resolved).catch(() => resolved)
if (!isAllowedLocalReadPath(resolved) && !isAllowedLocalReadPath(realResolved)) {