{"draft":null,"from":20,"to":21,"files":[{"path":"client/test/client.test.ts","added":52,"removed":2,"diff":"--- a/client/test/client.test.ts\n+++ b/client/test/client.test.ts\n@@ -48,8 +48,8 @@\n import { absolute, writeFileAtomic } from \"../src/folder.ts\";\n import { runHook } from \"../src/hook.ts\";\n import { tryFolderLock } from \"../src/lock.ts\";\n-import { commandTable, main } from \"../src/main.ts\";\n-import { argvFor } from \"../src/mcp.ts\";\n+import { boxServer, commandTable, main } from \"../src/main.ts\";\n+import { argvFor, confineCall, mcpTools } from \"../src/mcp.ts\";\n import { pulledText } from \"../src/queue.ts\";\n import { noteText, titleLine } from \"../src/review.ts\";\n import { screenAnswer, throughLink, unsafeLink, unsafePath } from \"../src/safety.ts\";\n@@ -2641,6 +2641,56 @@\n \t\tassert.deepEqual(parsed.positionals, [\"--server=x\"]);\n \t});\n \n+\tit(\"keeps a tool call's folder and --attach files inside the folder the server started in (Security on 233)\", async () => {\n+\t\tconst { folders } = await project({ \"a.txt\": \"one\\n\" }, \"alice\");\n+\t\tconst start = folders.alice!;\n+\t\tconst refused = (input: Record<string, unknown>) => {\n+\t\t\tconst r = confineCall(start, input);\n+\t\t\treturn \"refused\" in r ? r.refused : \"\";\n+\t\t};\n+\t\tassert.deepEqual(confineCall(start, {}), { folder: start });\n+\t\tassert.deepEqual(confineCall(start, { folder: \"sub\" }), { folder: join(start, \"sub\") });\n+\t\tassert.deepEqual(confineCall(start, { attach: \"a.txt, sub/b.png\" }), { folder: start });\n+\t\tassert.match(refused({ folder: \"..\" }), /^folder \"\\.\\.\" is outside .*, the folder this server started in/);\n+\t\tassert.match(refused({ folder: dirname(start) }), /is outside/);\n+\t\tassert.match(refused({ folder: \"sub/../..\" }), /is outside/);\n+\t\tassert.match(refused({ attach: \"a.txt,../x.png\" }), /^--attach \\.\\.\\/x\\.png is outside/);\n+\t\tassert.match(refused({ attach: join(tmpdir(), \"x.png\") }), /is outside/);\n+\t\tassert.match(refused({ folder: \"sub\", attach: \"../../x.png\" }), /is outside/);\n+\t\tassert.deepEqual(confineCall(start, { folder: \"sub\", attach: \"../a.txt\" }), { folder: join(start, \"sub\") });\n+\t\tconst server = mcp(start);\n+\t\ttry {\n+\t\t\tconst up = await server.call(\"tools/call\", { name: \"status\", arguments: { folder: \"..\" } });\n+\t\t\tassert.equal(up.result.isError, true);\n+\t\t\tassert.match(up.result.content[0].text, /is outside/);\n+\t\t\tconst attach = await server.call(\"tools/call\", {\n+\t\t\t\tname: \"issue\",\n+\t\t\t\targuments: { args: [\"1\"], comment: \"see\", attach: \"../../secret.png\" },\n+\t\t\t});\n+\t\t\tassert.equal(attach.result.isError, true);\n+\t\t\tassert.match(attach.result.content[0].text, /^--attach \\.\\.\\/\\.\\.\\/secret\\.png is outside/);\n+\t\t} finally {\n+\t\t\tserver.close();\n+\t\t}\n+\t});\n+\n+\tit(\"serves no -file twin, so no tool reads its text from a file\", () => {\n+\t\tfor (const tool of mcpTools())\n+\t\t\tfor (const key of Object.keys(tool.inputSchema.properties as object))\n+\t\t\t\tassert.ok(!key.endsWith(\"-file\") && key !== \"file\", `${tool.name} takes ${key}`);\n+\t});\n+\n+\tit(\"abso login, box and logout outside a folder act on https://api.abso.dev\", () => {\n+\t\tconst outside = mkdtempSync(join(tmpdir(), \"abso-login-\"));\n+\t\ttry {\n+\t\t\tassert.equal(boxServer(parseArgs(\"login\", [], { server: \"string\" }), { cwd: outside }), \"https://api.abso.dev\");\n+\t\t\tconst given = parseArgs(\"login\", [\"--server\", \"https://example.test\"], { server: \"string\" });\n+\t\t\tassert.equal(boxServer(given, { cwd: outside }), \"https://example.test\");\n+\t\t} finally {\n+\t\t\trmSync(outside, { recursive: true, force: true });\n+\t\t}\n+\t});\n+\n \tit(\"publish --done takes the start note back once it is published\", async () => {\n \t\tconst { folders } = await project({ \"a.txt\": \"one\\n\" }, \"alice\");\n \t\tassert.equal((await avcs(folders.alice!, \"start\", \"Two\", \"a.txt\")).exit, 0);"}],"unmatched":[]}