Cron store tests: cover existing directory permission hardening

This commit is contained in:
Vincent Koc 2026-03-06 00:45:54 -05:00
parent 37e572f028
commit a19bcd97b3

View File

@ -97,6 +97,21 @@ describe("cron store", () => {
expect(backupMode).toBe(0o600);
},
);
it.skipIf(process.platform === "win32")(
"hardens an existing cron store directory to owner-only permissions",
async () => {
const store = await makeStorePath();
const storeDir = path.dirname(store.storePath);
await fs.mkdir(storeDir, { recursive: true, mode: 0o755 });
await fs.chmod(storeDir, 0o755);
await saveCronStore(store.storePath, makeStore("job-1", true));
const storeDirMode = (await fs.stat(storeDir)).mode & 0o777;
expect(storeDirMode).toBe(0o700);
},
);
});
describe("saveCronStore", () => {