fix(logging): harden log storage and cleanup

This commit is contained in:
Tam Nhu Tran committed 2026-04-08 16:34:36 -04:00
1 parent a47cf022c6
commit 1923fce2ed
5 files changed
+151 -9

No files matched your search

@@ -3,6 +3,7 @@ import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import {
ensureLoggingDirectories,
getCurrentLogPath,
getLogArchiveDir,
getNativeLogsDir,
@@ -43,4 +44,14 @@ describe('logging path helpers', () => {
false
);
});
it('creates log directories with restrictive permissions', () => {
ensureLoggingDirectories();
const logsMode = fs.statSync(getNativeLogsDir()).mode & 0o777;
const archiveMode = fs.statSync(getLogArchiveDir()).mode & 0o777;
expect(logsMode).toBe(0o700);
expect(archiveMode).toBe(0o700);
});
});