fix: harden PTY events and configured roots

This commit is contained in:
N0zoM1z0
2026-07-14 15:21:39 +08:00
parent 2575b30dfc
commit 31b40f39e4
14 changed files with 180 additions and 40 deletions
+15
View File
@@ -93,6 +93,21 @@ describe("evidence bundle filesystem adapter", () => {
).toMatchObject({ ok: true });
});
it("uses valid evidence roots when another configured root is missing", async () => {
directory = await mkdtemp(join(tmpdir(), "rea-evidence-roots-"));
const path = join(directory, "bundle.json");
const configured = {
...policy(directory),
roots: [join(directory, "missing"), directory],
};
expect(
await writeEvidenceBundle(bundle(), path, false, configured),
).toMatchObject({ ok: true });
expect(await readEvidenceBundle(path, configured)).toMatchObject({
ok: true,
});
});
it("rejects traversal and symlink escape from approved roots", async () => {
directory = await mkdtemp(join(tmpdir(), "rea-evidence-"));
const root = join(directory, "approved");