mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-21 06:51:01 +00:00
Cron run-log tests: cover existing directory permission hardening
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user