fix: harden macOS bar launch descriptor (#1533)

Hardens the macOS bar launch.json descriptor against untrusted/foreign-owned files and constrains the decoded descriptor; blocks dashboard file writes to the launch descriptor.
This commit is contained in:
Kai (Tam Nhu) Tran authored and GitHub committed 2026-06-15 23:24:13 -04:00
1 parent 619723e9b7
commit 10aff10a67
3 files changed
+106 -3

No files matched your search

+12
View File
@@ -437,6 +437,18 @@ export function validateFilePath(filePath: string): {
if (pathSegments.includes('.git') || pathSegments.includes('node_modules')) {
return { valid: false, readonly: false, error: 'Access to this path is not allowed' };
}
// launch.json is an executable descriptor consumed by the native macOS bar.
// It must only be written by trusted bar install/launch code paths, not the
// generic dashboard file API.
if (
pathSegments.length === 2 &&
pathSegments[0] === 'bar' &&
pathSegments[1] === 'launch.json'
) {
return { valid: false, readonly: false, error: 'Access to this path is not allowed' };
}
return { valid: true, readonly: false };
}