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,GAAU,qBAAA,CAAsB,OAAA,CAAQ,GAAA,CAAI,iBAAiB,CAAC,CAAA;AACpE,EAAA,OAAO,iBAAiB,OAAA,IAAW,qBAAA;AACrC;AAUO,IAAM,qBAAA,uBAAiD,GAAA,CAAI;AAAA,EAChE,MAAA;AAAA,EAAQ,IAAA;AAAA,EAAM,KAAA;AAAA,EAAO,MAAA;AAAA,EAAQ,KAAA;AAAA,EAAO,MAAA;AAAA,EACpC,MAAA;AAAA,EAAQ,MAAA;AAAA,EAAQ,KAAA;AAAA,EAAO,KAAA;AAAA,EAAO,SAAA;AAAA,EAC9B,QAAA;AAAA,EAAU,SAAA;AAAA,EAAW,SAAA;AAAA,EAAW,MAAA;AAAA,EAAQ,MAAA;AAAA,EAAQ,KAAA;AAAA,EAAO,SAAA;AAAA,EAAW,WAAA;AAAA,EAClE,KAAA;AAAA,EAAO,OAAA;AAAA,EAAS,MAAA;AAAA,EAAQ,KAAA;AAAA,EAAO,IAAA;AAAA,EAAM,KAAA;AAAA,EAAO;AAC9C,CAAC;AAIM,SAAS,sBAAsB,IAAA,EAAuB;AAC3D,EAAA,OAAO,qBAAA,CAAsB,GAAA,CAAI,IAAA,CAAK,WAAA,EAAa,CAAA;AACrD;AAGO,SAAS,uBAAuB,QAAA,EAA0B;AAC/D,EAAA,OACE,wCAAwC,QAAQ,CAAA,mRAAA,CAAA;AAMpD","file":"command-allowlist.mjs","sourcesContent":["/**\n * Pure, dependency-light workspace command-allowlist logic, shared by the\n * daemon's `command_execute` MCP tool (`command-tools.ts`) and any other\n * host that needs to gate shell execution against the same\n * `<workspace>/.agentproto/allowed-commands.json` file — e.g. the\n * `mastra-agent` adapter's own `command_execute` workspace tool, which runs\n * out-of-process from the daemon and has no other way to reach this logic.\n *\n * Kept free of daemon-only concerns (session recording, PR provenance,\n * OS-level sandboxing) so it stays cheap to import from a spawned child\n * process — no `SessionsRegistry`, no `@agentproto/command-sandbox`.\n *\n * Allowlist file shape — each entry in `commands` is either a plain\n * basename string (unconstrained args) or an object constraining the argv\n * prefix:\n *   {\n *     \"version\": 1,\n *     \"commands\": [\n *       \"claude\",\n *       \"node\",\n *       { \"command\": \"git\", \"args\": [\"status\"] }\n *     ]\n *   }\n *\n * Match is by command BASENAME. A plain string entry allows that basename\n * with ANY args. An object entry with `args` only allows invocations whose\n * argv starts with exactly that token sequence (a prefix match). When a\n * basename has BOTH a plain entry and constrained entries, the plain entry\n * wins.\n */\n\nimport { existsSync } from \"node:fs\"\nimport { readFile, stat } from \"node:fs/promises\"\nimport { basename, resolve } from \"node:path\"\n\nexport const ALLOWLIST_REL = \".agentproto/allowed-commands.json\"\n\n/** One normalized allowlist entry — a basename with an optional argv-prefix\n *  constraint. `args` absent ⇒ unconstrained (any args), matching a plain\n *  basename-string entry in the JSON file. */\nexport interface AllowlistEntry {\n  command: string\n  args?: string[]\n}\n\ninterface AllowlistFile {\n  version?: number\n  commands?: Array<string | { command?: unknown; args?: unknown }>\n  /** Optional top-level terminal gate mode — governs `terminal_start`\n   *  (see `TerminalGateMode` / `loadTerminalGateMode`). Same file as the\n   *  `commands` allowlist on purpose: one place to reason about gating. */\n  terminalGate?: unknown\n}\n\ninterface AllowlistCacheEntry {\n  mtimeMs: number\n  entries: AllowlistEntry[]\n}\n\nlet allowlistCache: { path: string; entry: AllowlistCacheEntry } | null = null\n\nfunction normalizeAllowlistEntry(\n  raw: string | { command?: unknown; args?: unknown },\n): AllowlistEntry | undefined {\n  if (typeof raw === \"string\") {\n    const command = raw.trim()\n    return command.length > 0 ? { command } : undefined\n  }\n  if (typeof raw.command !== \"string\" || raw.command.trim().length === 0) {\n    return undefined\n  }\n  const command = raw.command.trim()\n  if (raw.args === undefined) return { command }\n  if (!Array.isArray(raw.args) || !raw.args.every(a => typeof a === \"string\")) {\n    // Malformed `args` (not a string array) — drop the constraint rather\n    // than silently allowlisting an unintended shape; the operator gets a\n    // basename-only entry, which is at least not MORE permissive than\n    // the array they wrote.\n    return undefined\n  }\n  return { command, args: [...raw.args] }\n}\n\n/** Load the workspace's allowlist as normalized entries (basename +\n *  optional argv-prefix constraint). Cheap stat-cached, same as\n *  `loadAllowlist`; both share one cache keyed on the file's mtime. */\nexport async function loadAllowlistEntries(\n  workspace: string,\n): Promise<AllowlistEntry[]> {\n  const path = resolve(workspace, ALLOWLIST_REL)\n  if (!existsSync(path)) {\n    allowlistCache = null\n    return []\n  }\n  try {\n    const s = await stat(path)\n    if (\n      allowlistCache &&\n      allowlistCache.path === path &&\n      allowlistCache.entry.mtimeMs === s.mtimeMs\n    ) {\n      return allowlistCache.entry.entries\n    }\n    const raw = await readFile(path, \"utf8\")\n    const parsed = JSON.parse(raw) as AllowlistFile\n    const list = Array.isArray(parsed.commands) ? parsed.commands : []\n    const entries = list\n      .map(normalizeAllowlistEntry)\n      .filter((e): e is AllowlistEntry => e !== undefined)\n    allowlistCache = { path, entry: { mtimeMs: s.mtimeMs, entries } }\n    return entries\n  } catch (err) {\n    // Bad JSON / unreadable file ⇒ deny all and surface in the error\n    // the next caller gets. Don't poison the cache.\n    console.error(\n      `[command-allowlist] failed to load ${ALLOWLIST_REL} (will deny all):`,\n      err,\n    )\n    allowlistCache = null\n    return []\n  }\n}\n\n/** Basename-only view of the allowlist — every basename that has AT LEAST\n *  ONE entry, constrained or not. Existing callers (cron-scheduler.ts,\n *  task-ledger.ts, supervisor.ts) gate on basename alone, same as before\n *  this change; only `command_execute` itself enforces argv constraints\n *  (see `isCommandAllowed`). */\nexport async function loadAllowlist(workspace: string): Promise<Set<string>> {\n  const entries = await loadAllowlistEntries(workspace)\n  return new Set(entries.map(e => e.command))\n}\n\n/** What a shell gate actually executes, after `resolveShellGateExec`. */\nexport interface ResolvedShellGateExec {\n  command: string\n  args: string[]\n  /** The original whole-shell-line `command`, set only when it was\n   *  rewritten to `bash -c <line>`; used to make refusals readable. */\n  shellLine?: string\n}\n\n/**\n * Resolve the argv a shell gate (`{command, args?}`) should run. A task\n * `verify` or policy gate is often written as a WHOLE shell line in `command`\n * with no `args` (`\"grep -q x /a/b/RAPPORT.md\"`, `\"cd /x && test -s a\"`).\n * Gating that string by `basename()` yields the text after its last `/`\n * (`RAPPORT.md`) and refuses with a misleading error, so a `command` that\n * contains whitespace, has no `args` and is not itself an existing file path\n * is run as `bash -c <line>`. The allowlist then applies to `bash`, which is\n * exactly the explicit `{command:\"bash\", args:[\"-c\", ...]}` form. Anything\n * else is returned unchanged. A relative `command` is probed against `cwd`\n * (the directory the gate runs in), not the daemon's own cwd.\n */\nexport function resolveShellGateExec(\n  spec: { command: string; args?: readonly string[] },\n  cwd?: string,\n): ResolvedShellGateExec {\n  const args = spec.args ?? []\n  const line = spec.command.trim()\n  if (\n    args.length === 0 &&\n    /\\s/.test(line) &&\n    !existsSync(resolve(cwd ?? process.cwd(), spec.command))\n  ) {\n    return { command: \"bash\", args: [\"-c\", line], shellLine: line }\n  }\n  return { command: spec.command, args: [...args] }\n}\n\n/**\n * Allowlist check for a resolved shell gate. Plain gates keep the historical\n * basename-only rule; a rewritten `bash -c <line>` additionally honours any\n * argv constraint on a `bash` entry, so the auto-rewrite cannot bypass an\n * operator who allowlisted bash for specific arguments only.\n */\nexport function isShellGateExecAllowed(\n  entries: readonly AllowlistEntry[],\n  target: ResolvedShellGateExec,\n): boolean {\n  const baseName = basename(target.command)\n  return target.shellLine === undefined\n    ? entries.some(e => e.command === baseName)\n    : isCommandAllowed(entries, baseName, target.args)\n}\n\n/** `not in allowlist` text for a gate refusal. Names the command that was\n *  actually checked and, when it came from a shell line, that line. */\nexport function describeGateRefusal(\n  label: string,\n  baseName: string,\n  shellLine?: string,\n): string {\n  const shown =\n    shellLine === undefined\n      ? \"\"\n      : ` (shell line: ${shellLine.length > 200 ? `${shellLine.slice(0, 200)}...` : shellLine})`\n  return `${label} command '${baseName}' not in allowlist${shown}`\n}\n\n/** True when `pattern` (an allowed argv prefix) matches the start of\n *  `actual` token-for-token. An empty `pattern` matches anything. */\nfunction argsMatchPrefix(pattern: readonly string[], actual: readonly string[]): boolean {\n  if (pattern.length > actual.length) return false\n  return pattern.every((tok, i) => actual[i] === tok)\n}\n\n/** Argv-aware allowlist check used by `command_execute`. A basename with\n *  no matching entry ⇒ denied. A basename with any unconstrained entry\n *  (plain string, or object with no `args`) ⇒ allowed regardless of args.\n *  Otherwise every matching entry is constrained, so `args` must match\n *  one of them as a prefix. */\nexport function isCommandAllowed(\n  entries: readonly AllowlistEntry[],\n  baseName: string,\n  args: readonly string[],\n): boolean {\n  const matching = entries.filter(e => e.command === baseName)\n  if (matching.length === 0) return false\n  if (matching.some(e => e.args === undefined)) return true\n  return matching.some(e => argsMatchPrefix(e.args!, args))\n}\n\n// ── terminal gate mode ─────────────────────────────────────────────\n// `command_execute` refuses any command outside the workspace allowlist,\n// but `terminal_start` spawns arbitrary argv under a PTY with no check —\n// the gate is decorative while that door is open. A three-valued mode\n// closes it: `terminal_start`'s argv[0] must pass the SAME allowlist\n// check `command_execute` applies, unless the operator deliberately\n// opens it (or closes it entirely).\n\n/**\n * How `terminal_start` is gated for a workspace:\n *   - `\"allowlist\"` — `argv[0]` must pass the same allowlist check\n *     `command_execute` applies. The shipped default.\n *   - `\"all\"` — no check. The legitimate setting for a trusted local\n *     workspace: this task exists so `all` becomes a deliberate\n *     DECISION, not an accident of which tool the caller happened to\n *     use.\n *   - `\"off\"` — `terminal_start` is refused outright, whatever the argv.\n *     NOTE: `off` means the door is CLOSED, not that the gate is\n *     disabled — the name reads both ways and the wrong reading is a\n *     security hole.\n */\nexport type TerminalGateMode = \"allowlist\" | \"all\" | \"off\"\n\n/** Global-default env var: the fallback when a workspace's allowlist\n *  file carries no `terminalGate` field. */\nexport const TERMINAL_GATE_ENV = \"AGENTPROTO_TERMINAL_GATE\"\n\n/** Shipped default: gate `terminal_start` through the allowlist, same as\n *  `command_execute`. */\nexport const DEFAULT_TERMINAL_GATE: TerminalGateMode = \"allowlist\"\n\nfunction parseTerminalGateMode(raw: unknown): TerminalGateMode | undefined {\n  return raw === \"allowlist\" || raw === \"all\" || raw === \"off\" ? raw : undefined\n}\n\n/**\n * Resolve the terminal gate mode for `workspace`, highest priority first:\n * the workspace's own `terminalGate` field in\n * `<workspace>/.agentproto/allowed-commands.json`, then the global\n * default from `AGENTPROTO_TERMINAL_GATE`, then\n * `DEFAULT_TERMINAL_GATE`.\n *\n * NOTE the precedence is the OPPOSITE of `loadSandboxConfig`'s\n * env-as-escape-hatch: here the env var is the GLOBAL DEFAULT, so a\n * workspace's explicit setting deliberately WINS over it. Don't \"fix\"\n * that — a workspace must be able to pin its own posture.\n *\n * An unrecognised value in either place resolves to\n * `DEFAULT_TERMINAL_GATE` and is never treated as `all` — fail toward\n * the gate, not away from it.\n */\nexport async function loadTerminalGateMode(\n  workspace: string,\n): Promise<TerminalGateMode> {\n  const path = resolve(workspace, ALLOWLIST_REL)\n  let fromWorkspace: TerminalGateMode | undefined\n  if (existsSync(path)) {\n    try {\n      const raw = await readFile(path, \"utf8\")\n      fromWorkspace = parseTerminalGateMode(\n        (JSON.parse(raw) as AllowlistFile).terminalGate,\n      )\n    } catch (err) {\n      // Bad JSON / unreadable file — the allowlist loader denies all on\n      // the same condition; fail toward the gate here too.\n      console.error(\n        `[command-allowlist] failed to read terminalGate from ${ALLOWLIST_REL} (will use default):`,\n        err,\n      )\n    }\n  }\n  const fromEnv = parseTerminalGateMode(process.env[TERMINAL_GATE_ENV])\n  return fromWorkspace ?? fromEnv ?? DEFAULT_TERMINAL_GATE\n}\n\n/**\n * Command basenames that execute arbitrary code and read the filesystem\n * unrestricted. Allowlisting one grants a caller full host code execution +\n * FS read — the workspace cwd-anchor bounds only the working directory, not\n * what the interpreter itself opens. Used to surface a one-time warning\n * (see `isInterpreterBasename` / `interpreterExecWarning`) until an OS-level\n * command sandbox lands.\n */\nexport const INTERPRETER_BASENAMES: ReadonlySet<string> = new Set([\n  \"bash\", \"sh\", \"zsh\", \"dash\", \"ksh\", \"fish\",\n  \"node\", \"deno\", \"bun\", \"tsx\", \"ts-node\",\n  \"python\", \"python2\", \"python3\", \"ruby\", \"perl\", \"php\", \"rscript\", \"osascript\",\n  \"env\", \"xargs\", \"make\", \"npx\", \"uv\", \"uvx\", \"pipx\",\n])\n\n/** True when `name` (a command basename) is a code interpreter. Case-insensitive\n *  so `Rscript`/`RSCRIPT` match. */\nexport function isInterpreterBasename(name: string): boolean {\n  return INTERPRETER_BASENAMES.has(name.toLowerCase())\n}\n\n/** Human-readable warning for allowlisting/running an interpreter. */\nexport function interpreterExecWarning(baseName: string): string {\n  return (\n    `command_execute ran the interpreter '${baseName}', which executes ` +\n    `arbitrary code and can read files outside the workspace — the cwd anchor ` +\n    `does not confine it. Allowlisting interpreters grants full host code ` +\n    `execution; prefer allowlisting specific tools. An OS-level command ` +\n    `sandbox is planned as the real confinement.`\n  )\n}\n"]}