mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 06:17:27 +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
@@ -42,6 +42,22 @@ describe('validateFilePath', () => {
|
||||
expect(result.readonly).toBe(false);
|
||||
});
|
||||
|
||||
test('rejects writes to the macOS bar launch descriptor', () => {
|
||||
const filePath = path.join(tempDir, '.ccs', 'bar', 'launch.json');
|
||||
const result = validateFilePath(filePath);
|
||||
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.readonly).toBe(false);
|
||||
});
|
||||
|
||||
test('still allows other writes inside the bar directory', () => {
|
||||
const filePath = path.join(tempDir, '.ccs', 'bar', 'serve.log');
|
||||
const result = validateFilePath(filePath);
|
||||
|
||||
expect(result.valid).toBe(true);
|
||||
expect(result.readonly).toBe(false);
|
||||
});
|
||||
|
||||
test('rejects sibling paths that only share ~/.ccs prefix', () => {
|
||||
const bypassPath = path.join(tempDir, '.ccs-evil', 'config.yaml');
|
||||
const result = validateFilePath(bypassPath);
|
||||
|
||||
Reference in new issue
Block a user