r025: expose direct long-running Unraid terminal
This commit is contained in:
1 parent
b0070861d2
commit
3c03924110
9 files changed
+73
-21
No files matched your search
+18
-1
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { parseConfig, SAFE_DEFAULT_TOOLS } from "./auth";
|
||||
import { installCommunityApp, runReadOnlyCommand, sanitizeLogOutput } from "./helpers";
|
||||
import { getToolRisk } from "./tools";
|
||||
import { getToolRisk, toolByName } from "./tools";
|
||||
|
||||
describe("secure tool configuration", () => {
|
||||
test("new and incomplete configs use the read-only baseline", () => {
|
||||
@@ -81,6 +81,23 @@ describe("risk classification", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("direct Unraid terminal", () => {
|
||||
test("accepts a normal command with the extended timeout", async () => {
|
||||
const tool = toolByName("unraid_system_shell");
|
||||
expect(tool).toBeDefined();
|
||||
const result = JSON.parse(await tool!.handler({ command: "printf ready", timeout_seconds: 301 }));
|
||||
expect(result.exit_code).toBe(0);
|
||||
expect(result.stdout).toBe("ready");
|
||||
});
|
||||
|
||||
test("rejects excessive timeouts and oversized scripts", async () => {
|
||||
const tool = toolByName("unraid_system_shell");
|
||||
expect(tool).toBeDefined();
|
||||
expect(() => tool!.handler({ command: "true", timeout_seconds: 1801 })).toThrow();
|
||||
expect(() => tool!.handler({ command: "x".repeat(262_145) })).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("read-only shell", () => {
|
||||
test("executes an allowlisted program without a shell", async () => {
|
||||
const result = JSON.parse(await runReadOnlyCommand("ls", ["-ld", "/"], 5));
|
||||
|
||||
Reference in new issue
Block a user