fix(process): return private runtime ownership at allocation

Use POSIX mkdtemp owner-only allocation directly instead of adding a fallible permission rewrite and rollback before returning the cleanup owner. Respect restrictive umasks, assert privacy and real scratch access, and align provider documentation.
This commit is contained in:
morluto
2026-10-12 16:30:53 +08:00
parent 07b36c1489
commit c22111eca2
4 changed files with 12 additions and 14 deletions
@@ -1,6 +1,7 @@
import { access, stat } from "node:fs/promises";
import { access, stat, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { fileURLToPath } from "node:url";
import { join } from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
@@ -57,7 +58,8 @@ describe("provider process runtime and wait primitives", () => {
parent: tmpdir(),
prefix: "rea-provider-test-",
});
expect((await stat(runtime.path)).mode & 0o777).toBe(0o700);
expect((await stat(runtime.path)).mode & 0o077).toBe(0);
await writeFile(join(runtime.path, "owned-scratch"), "fixture");
const first = runtime.close();
const second = runtime.close();