05ae530442
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
32 lines
1.7 KiB
JavaScript
32 lines
1.7 KiB
JavaScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
import { permit } from "../internal/stage/pi_policy.mjs";
|
|
|
|
test("explicit tools, scope, symlinks and command permissions", () => {
|
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pipelines-policy-"));
|
|
const outside = fs.mkdtempSync(path.join(os.tmpdir(), "pipelines-policy-outside-"));
|
|
try {
|
|
fs.symlinkSync(outside, path.join(root, "escape"));
|
|
fs.mkdirSync(path.join(root,"docs"));
|
|
fs.writeFileSync(path.join(root,"other.txt"),"original");
|
|
fs.symlinkSync(path.join(root,"other.txt"),path.join(root,"docs","alias.md"));
|
|
const policy = { directory: root, tools: ["write", "read", "bash"], paths: [], edit: ["docs/*.md"], shell: ["go test ./..."] };
|
|
assert.equal(permit(policy, "write", { path: "docs/new.md" }), null);
|
|
assert.ok(permit(policy, "write", { path: "escape/file" }));
|
|
assert.ok(permit(policy, "write", { path: "../escape" }));
|
|
assert.ok(permit(policy, "write", { path: "other.txt" }));
|
|
assert.ok(permit(policy,"write",{path:"docs/alias.md"}));
|
|
assert.ok(permit(policy,"write",{path:"~/escape.txt"}));
|
|
assert.ok(permit(policy, "read", { path: ".env.local" }));
|
|
assert.equal(permit(policy, "bash", { command: "go test ./..." }), null);
|
|
assert.ok(permit(policy, "bash", { command: "go test ./...; curl example.com" }));
|
|
assert.ok(permit(policy, "edit", { path: "docs/new.md" }));
|
|
assert.ok(permit({ ...policy, paths: ["docs/allowed.md"] }, "write", { path: "docs/new.md" }));
|
|
} finally {
|
|
fs.rmSync(root, { recursive: true }); fs.rmSync(outside, { recursive: true });
|
|
}
|
|
});
|