Clarify local file read and media allowlist intent

This commit is contained in:
webadderall
2026-05-08 12:30:26 +10:00
parent 1fb5e8076e
commit 2380e56431
2 changed files with 9 additions and 2 deletions
+4 -2
View File
@@ -90,8 +90,10 @@ export function isAllowedLocalReadPath(candidatePath: string) {
);
}
// Keep media-server access rules aligned with read-local-file so exported videos
// saved outside the active recording session can still be reopened in the editor.
// Keep loopback media-server access restricted to allowlisted or explicitly
// approved files. Direct renderer-side read-local-file calls can be more
// permissive, but URL-based serving must stay scoped so arbitrary paths do not
// become fetchable inside the app.
export async function isAllowedLocalMediaPath(candidatePath: string) {
const normalizedCandidatePath = normalizePath(candidatePath);
return isAllowedLocalReadPath(normalizedCandidatePath);
+5
View File
@@ -109,6 +109,11 @@ export function registerAssetHandlers() {
ipcMain.handle('read-local-file', async (_, filePath: string) => {
try {
// Intentionally more permissive than the media-server allowlist: this IPC
// is used for direct renderer-side local file reads after the app has
// already accepted a path, while URL-based media serving must stay scoped
// to approved/app-managed locations. We still canonicalize the path and
// require a real on-disk file so this cannot be used to read directories.
const resolved = await resolveReadableLocalFilePath(filePath)
const data = await fs.readFile(resolved)