Skip to content

A motion design studio on your own machine: Claude makes the video step by step, you approve every stage. Bring your own Claude Code or API key.

Tests pass on macOS: confine() realpaths the project folder, gates test symlinks /etc/hosts

nomima-app7c09415aa168
diff --git a/src/backends/anthropic-api.mjs b/src/backends/anthropic-api.mjs
index 38d4456..2cde5b6 100644
--- a/src/backends/anthropic-api.mjs
+++ b/src/backends/anthropic-api.mjs
@@ -284,7 +284,9 @@ export function confine(work, path, creating = false) {
let probe = abs;
if (creating) while (!existsSync(probe)) probe = dirname(probe);
const real = existsSync(probe) ? realpathSync(probe) : probe;
- if (!isInside(work, real) || !isInside(work, abs)) throw new Error(`${path} is outside the project folder`);
+ // The project folder itself may sit behind a symlink (macOS keeps os.tmpdir() under /var -> /private/var), so compare real with real.
+ const base = existsSync(work) ? realpathSync(work) : work;
+ if (!isInside(base, real) || !isInside(work, abs)) throw new Error(`${path} is outside the project folder`);
return abs;
}
diff --git a/test/gates.test.mjs b/test/gates.test.mjs
index 222c686..eee0ec2 100644
--- a/test/gates.test.mjs
+++ b/test/gates.test.mjs
@@ -34,7 +34,7 @@ test('submit enforces items, checks, folder and review mode', async (t) => {
assert.throws(() => gates.submit(root, id, 'directions', { ...ok, error_checks: [] }), /missing/);
assert.throws(() => gates.submit(root, id, 'directions', { ...ok, error_checks: [...ok.error_checks.slice(1), { id: ok.error_checks[0].id, result: 'n/a' }] }), /needs a note/);
assert.throws(() => gates.submit(root, id, 'directions', { ...ok, items: [{ path: '../../../etc/passwd' }] }), /outside|doesn't exist/);
- symlinkSync('/etc/hostname', join(work, 'out', 'sneaky.png'));
+ symlinkSync('/etc/hosts', join(work, 'out', 'sneaky.png'));
assert.throws(() => gates.submit(root, id, 'directions', { ...ok, items: [{ path: 'out/sneaky.png' }] }), /outside/);
assert.throws(() => gates.submit(root, id, 'final', ok), /can't start yet/);