mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 00:16:38 +00:00
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:
1 parent
619723e9b7
commit
10aff10a67
3 files changed
+106
-3
No files matched your search
@@ -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 };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user