@rosthq/cli 0.7.29 → 0.7.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +398 -106
- package/dist/index.js.map +4 -4
- package/dist/runner-sandbox.d.ts +94 -0
- package/dist/runner-sandbox.d.ts.map +1 -0
- package/dist/runner-serve.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export declare const SANDBOX_EXEC_PATH = "/usr/bin/sandbox-exec";
|
|
2
|
+
export declare const RUNNER_TEMP_PREFIXES: readonly ["rost-runner-mcp-", "rost-runner-sandbox-", "rost-runner-askpass-"];
|
|
3
|
+
export type SandboxMode = "auto" | "off" | "strict";
|
|
4
|
+
export declare function parseSandboxMode(value: string | undefined): SandboxMode;
|
|
5
|
+
export declare function parseSandboxNetwork(value: string | undefined): {
|
|
6
|
+
allowNetwork: boolean;
|
|
7
|
+
unrecognized: string | null;
|
|
8
|
+
};
|
|
9
|
+
export type SandboxProfileInput = {
|
|
10
|
+
workspaceDir: string;
|
|
11
|
+
tmpDir: string;
|
|
12
|
+
homeDir: string;
|
|
13
|
+
denyReadPaths: string[];
|
|
14
|
+
allowWritePaths: string[];
|
|
15
|
+
allowNetwork: boolean;
|
|
16
|
+
strict: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Build a macOS seatbelt (SBPL) profile string. Pure — fully unit-testable without
|
|
20
|
+
* spawning anything.
|
|
21
|
+
*
|
|
22
|
+
* READS differ by mode: guard is allow-default with explicit credential/bearer denies;
|
|
23
|
+
* strict is deny-default with a system+workspace allowlist.
|
|
24
|
+
*
|
|
25
|
+
* WRITES are deny-default in BOTH modes — the security review (finding 1) showed an
|
|
26
|
+
* allow-default guard write posture is a token-capture path: a prompt-injected model
|
|
27
|
+
* writes `[credential] helper=<evil>` / `core.hooksPath` into ~/.gitconfig (or a
|
|
28
|
+
* ~/bin/git shim, or a shell-login file), and the very next HARNESS-executed git op —
|
|
29
|
+
* unsandboxed, same HOME — runs attacker code at operator uid and can capture the
|
|
30
|
+
* GitHub installation token. A hand-enumerated denylist can never be complete, so
|
|
31
|
+
* writes are confined to the workspace + tmp + the model runtimes' own dirs, mirroring
|
|
32
|
+
* strict. The explicit persistence-vector deny is kept as last-wins defense in depth.
|
|
33
|
+
*
|
|
34
|
+
* Rule ordering is the whole game: SBPL evaluates in order, LAST match wins, and it
|
|
35
|
+
* has no notion of "most specific path wins". So the layout is deliberate:
|
|
36
|
+
*
|
|
37
|
+
* 1. base-dir READ denies (the runner base — dirs the workspace may live UNDER) —
|
|
38
|
+
* placed BEFORE the workspace re-allow, so a sibling workspace stays denied.
|
|
39
|
+
* 2. re-allow the model's OWN workspace — defeats (1) for its own checkout only.
|
|
40
|
+
* 3. credential-store + bearer-file READ denies — placed AFTER the workspace
|
|
41
|
+
* re-allow so nothing re-opens them (the production read-only turn runs with
|
|
42
|
+
* workspaceDir == tmpDir and the bearer state file lives in tmp: a broad "allow
|
|
43
|
+
* read of the workspace(=tmp)" would otherwise re-expose the bearer). These paths
|
|
44
|
+
* are never under the workspace, so denying them last is always safe.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildSeatbeltProfile(input: SandboxProfileInput): string;
|
|
47
|
+
export type SandboxSpec = {
|
|
48
|
+
kind: "none";
|
|
49
|
+
reason: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "seatbelt";
|
|
52
|
+
reason: string;
|
|
53
|
+
profile: string;
|
|
54
|
+
allowNetwork: boolean;
|
|
55
|
+
};
|
|
56
|
+
export type ResolveSandboxOptions = {
|
|
57
|
+
mode: SandboxMode;
|
|
58
|
+
platform: NodeJS.Platform;
|
|
59
|
+
workspaceDir: string;
|
|
60
|
+
tmpDir: string;
|
|
61
|
+
homeDir: string;
|
|
62
|
+
stateFile: string;
|
|
63
|
+
runnerBaseDir?: string;
|
|
64
|
+
allowWritePaths?: string[];
|
|
65
|
+
allowNetwork?: boolean;
|
|
66
|
+
sandboxExecAvailable?: boolean;
|
|
67
|
+
};
|
|
68
|
+
export declare function isSandboxExecAvailable(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Decide whether and how to sandbox a model spawn. `off` disables confinement (the
|
|
71
|
+
* founder-authorized loosened fallback for trusted demo machines — logged loudly by
|
|
72
|
+
* the caller). `auto`/`strict` require macOS + `sandbox-exec`; on any other platform
|
|
73
|
+
* they degrade to `none` with a reason (Linux namespace/Landlock confinement is a
|
|
74
|
+
* hardening follow-up), so the runner never fails to start for lack of a sandbox.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveSandboxSpec(options: ResolveSandboxOptions): SandboxSpec;
|
|
77
|
+
export type WrappedCommand = {
|
|
78
|
+
command: string;
|
|
79
|
+
args: string[];
|
|
80
|
+
profilePath: string | null;
|
|
81
|
+
};
|
|
82
|
+
export declare function wrapCommandWithSandbox(spec: SandboxSpec, command: string, args: string[], profilePath: string | null): WrappedCommand;
|
|
83
|
+
/**
|
|
84
|
+
* Remove stale runner temp artifacts (orphaned MCP config files carrying seat tokens,
|
|
85
|
+
* sandbox profiles, askpass helpers) from a directory. Best-effort and idempotent:
|
|
86
|
+
* per-file errors are swallowed so a locked/racing file never crashes startup.
|
|
87
|
+
* Returns the basenames actually removed. Only files older than `maxAgeMs` are
|
|
88
|
+
* touched, so a concurrently-running turn's live temp files are never yanked.
|
|
89
|
+
*/
|
|
90
|
+
export declare function sweepStaleRunnerTempFiles(dir: string, options?: {
|
|
91
|
+
maxAgeMs?: number;
|
|
92
|
+
now?: number;
|
|
93
|
+
}): Promise<string[]>;
|
|
94
|
+
//# sourceMappingURL=runner-sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-sandbox.d.ts","sourceRoot":"","sources":["../src/runner-sandbox.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAKzD,eAAO,MAAM,oBAAoB,+EAIvB,CAAC;AA0CX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AAC,EAAE,OAAO,CAAC;IAEvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAuBF,wBAAgB,sBAAsB,IAAI,OAAO,CAMhD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,qBAAqB,GAAG,WAAW,CA4C9E;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IAGf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAKF,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,cAAc,CAShB;AAED;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAChD,OAAO,CAAC,MAAM,EAAE,CAAC,CA6BnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-serve.d.ts","sourceRoot":"","sources":["../src/runner-serve.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"runner-serve.d.ts","sourceRoot":"","sources":["../src/runner-serve.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAczD,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CAC3C,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,EAAE,EAAE,aAAa,CAAC;IAClB,MAAM,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,CAAC;AAqEF,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuEjF;AAmKD,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAW5F"}
|