diff --git a/src/cron/run-log.test.ts b/src/cron/run-log.test.ts index ec4f5df961a..728cb039aab 100644 --- a/src/cron/run-log.test.ts +++ b/src/cron/run-log.test.ts @@ -114,6 +114,28 @@ describe("cron run log", () => { }, ); + it.skipIf(process.platform === "win32")( + "hardens an existing run-log directory to owner-only permissions", + async () => { + await withRunLogDir("openclaw-cron-log-dir-perms-", async (dir) => { + const runDir = path.join(dir, "runs"); + const logPath = path.join(runDir, "job-1.jsonl"); + await fs.mkdir(runDir, { recursive: true, mode: 0o755 }); + await fs.chmod(runDir, 0o755); + + await appendCronRunLog(logPath, { + ts: 1, + jobId: "job-1", + action: "finished", + status: "ok", + }); + + const runDirMode = (await fs.stat(runDir)).mode & 0o777; + expect(runDirMode).toBe(0o700); + }); + }, + ); + it("reads newest entries and filters by jobId", async () => { await withRunLogDir("openclaw-cron-log-read-", async (dir) => { const logPathA = path.join(dir, "runs", "a.jsonl");