Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Bot box: pass only the OMB_ variables a bot's processes read (#5301)

Milind Soni08c36a72fc2a
diff --git a/docs/bot-box.md b/docs/bot-box.md
index 8e181ee05e..f8e812e381 100644
--- a/docs/bot-box.md
+++ b/docs/bot-box.md
@@ -19,8 +19,11 @@ its database, its settings, other bots' folders and other turns' processes are n
| a network namespace with loopback only | Two loopback ports are bridged to unix sockets from outside (below); nothing else on the machine's loopback is reachable, and there is no route out |
The environment is an allow-list (`server/bot-box/env.ts`): the engine's own settings and keys, the harness capability
-tokens and a few names a shell expects. Every `OMB_CLOUD_*` setting, the server's own placement (`OMB_DATA_DIR`,
-`OMB_PORT`) and the workspace credentials are refused whatever a driver passed.
+tokens and a few names a shell expects. Of OpenMausBot's own `OMB_*` variables only those a bot's engine, hooks and MCP
+proxies read pass (`BOX_ENV_OMB_NAMES`); every other one an operator sets on the server, such as `OMB_SIGNIN_SMTP_URL`,
+stays out. Every `OMB_CLOUD_*` setting, the server's own placement (`OMB_DATA_DIR`, `OMB_PORT`), the CLI's session
+token and server address (`OPENMAUSBOT_TOKEN`, `OPENMAUSBOT_URL`) and the workspace credentials are refused whatever
+a driver passed.
## The two gates
@@ -112,7 +115,7 @@ or files, the base URL is the broker, a call with the token reaches the upstream
| Mount namespace (bubblewrap) | every boxed process | reading the server's data folder, other bots' folders, other turns' files in `/tmp`, `/.fly`; writing anywhere but its own folders | reading HOME's engine logins (the engine's own identity); a path a driver puts back on purpose |
| PID namespace | every boxed process | seeing, reading the environment of, or signalling another turn's or the server's processes | nothing inside the same box |
| Network namespace + the two gates | every boxed process with its own network | reaching this machine's other listeners, the local network, link-local, metadata, Fly's private network; any route out except the egress gate; any server route except `/api/internal/*` | what the harness routes allow with a valid per-turn bearer; a public destination |
-| Environment allow-list | every boxed process | `OMB_CLOUD_*`, the server's placement, workspace credentials, any unlisted name | the engines' own settings |
+| Environment allow-list | every boxed process | `OMB_CLOUD_*`, the server's placement, workspace credentials, any `OMB_*` setting a boxed process does not read, any unlisted name | the engines' own settings |
| Credential broker (T0b) | every boxed process with its own network | holding a provider key or an MCP header; using a token after its process or conversation ends; choosing the upstream | keys with no base-URL setting (named in the report); subscription logins |
| seccomp filter (T0c) | every boxed process on x86-64 | 34 system calls that only reach the kernel's attack surface: mount family, kernel modules, bpf, perf, userfaultfd, the kernel keyring, `open_by_handle_at`, `setns`, kexec, reboot, swap, clock setting, I/O ports (EPERM); a process of another architecture (killed) | anything an engine, shell, git, npm, python or Chrome uses: all allowed |
| `hidepid=invisible` on the host's /proc (T0c) | the whole machine, set by the root supervisor at boot, which then starts itself again through `setpriv` without CAP_SYS_ADMIN and CAP_SETPCAP (an own server's connector grants those two only for that remount, and only to an image that drops them) | a `maus` process outside a box (the browser engine, a helper) listing or reading root's processes | `maus` processes seeing each other; a box has its own /proc anyway |
diff --git a/server/bot-box/env.test.ts b/server/bot-box/env.test.ts
index edd091d57c..f9c0a275fe 100644
--- a/server/bot-box/env.test.ts
+++ b/server/bot-box/env.test.ts
@@ -1,6 +1,72 @@
+import { execFileSync } from "node:child_process";
+import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
-import { BOX_ENV_NAMES, BOX_ENV_NEVER, boxEnvironment, boxEnvironmentAllows, instanceEnvNames } from "./env.ts";
+import { BOX_ENV_NAMES, BOX_ENV_NEVER, BOX_ENV_OMB_NAMES, BOX_ENV_OMB_PREFIXES, boxEnvironment, boxEnvironmentAllows, instanceEnvNames } from "./env.ts";
+
+/** Every other `OMB_` name the server's code knows: decided to stay on the server, never in a bot's environment. A name
+ * ending in `_` is a family (`OMB_CLOUD_*`). */
+const SERVER_ONLY_OMB: ReadonlySet<string> = new Set([
+ "OMB_ACP_LIMIT_QUIET_MS", "OMB_ACP_NO_SIGNS_STOP_MS", "OMB_ACP_PLAN_LINES", "OMB_ACP_QUIET_NOTICE_MS",
+ "OMB_ACP_QUIET_TICK_MS", "OMB_ACP_SESSION_IDLE_", "OMB_ACP_SHARED_RECYCLE_MS", "OMB_ADMIN_", "OMB_ADMIN_MEMBERSHIP",
+ "OMB_ADMIN_URL", "OMB_ADMIN_WORKSPACE", "OMB_AGENT_BROWSER_PATH", "OMB_AI_CHECKS", "OMB_ANTHROPIC_API_KEY",
+ "OMB_ANTHROPIC_API_URL", "OMB_APP_VERSION", "OMB_ATTACHMENTS_MAX_BYTES", "OMB_AZURE_OPENAI_LIVE_DEPLOYMENT",
+ "OMB_AZURE_OPENAI_LIVE_ENDPOINT", "OMB_BOAT_API", "OMB_BOT_BOX", "OMB_BOX_CANARY", "OMB_BRAND_FILE",
+ "OMB_BROWSER_CONNECTION", "OMB_BROWSER_IDLE_HANDOVER_MS", "OMB_BROWSER_LANG", "OMB_BROWSER_LEGACY_SHELL",
+ "OMB_BROWSER_MAX_RUNNING", "OMB_BROWSER_SANDBOX", "OMB_BROWSER_SCREEN", "OMB_BROWSER_TIMEZONE", "OMB_BROWSER_TIMING",
+ "OMB_BUG_REPORT_URL", "OMB_CADDY_PATH", "OMB_CHROME_PATH", "OMB_CLAUDE_AUTOCOMPACT",
+ "OMB_CLAUDE_INHERIT_USER_CONFIG", "OMB_CLAUDE_SESSION_IDLE_", "OMB_CLI_OWNER_STDIN", "OMB_CLI_PREFIX",
+ "OMB_CLOUDFLARED_PATH", "OMB_CLOUD_", "OMB_CLOUD_ADMIN_URL", "OMB_CLOUD_AI_TOKEN", "OMB_CLOUD_AI_URL",
+ "OMB_CLOUD_BOAT_TOKEN", "OMB_CLOUD_BOAT_URL", "OMB_CLOUD_BOOTSTRAP_SECRET", "OMB_CLOUD_CAPS_DROPPED",
+ "OMB_CLOUD_CLIENT_IP_HEADER", "OMB_CLOUD_COMPUTER_IDLE_MS", "OMB_CLOUD_COMPUTER_START_BUDGET_MS",
+ "OMB_CLOUD_CONNECTED_APPS_GRANT", "OMB_CLOUD_DECIDER_TOKEN", "OMB_CLOUD_DECIDER_URL", "OMB_CLOUD_EDGE_ACME_EMAIL",
+ "OMB_CLOUD_EDGE_ACME_FALLBACK_ONLY", "OMB_CLOUD_EDGE_BIN", "OMB_CLOUD_EDGE_CERT_ISSUERS",
+ "OMB_CLOUD_EDGE_CLIENT_IP_HEADER", "OMB_CLOUD_EDGE_CONFIG", "OMB_CLOUD_EDGE_HOLD", "OMB_CLOUD_EDGE_STORAGE",
+ "OMB_CLOUD_EDGE_TLS", "OMB_CLOUD_EDGE_TRUSTED_PROXIES", "OMB_CLOUD_EXPORT_ONLY", "OMB_CLOUD_HARDEN",
+ "OMB_CLOUD_HOME", "OMB_CLOUD_IMAGE", "OMB_CLOUD_LEGACY_ORIGINS", "OMB_CLOUD_MACHINE_ID", "OMB_CLOUD_MOVES",
+ "OMB_CLOUD_PUBLIC_HOST", "OMB_CLOUD_ROLE", "OMB_CLOUD_SECRETS_FD", "OMB_CLOUD_STAGING",
+ "OMB_CLOUD_STOPPED_HOLD_DAYS", "OMB_CLOUD_TEAM_ID", "OMB_CLOUD_TEAM_LANGUAGE", "OMB_CLOUD_TEAM_NAME",
+ "OMB_CLOUD_TRUSTED_PROXIES", "OMB_CLOUD_TUNNEL_BIN", "OMB_CLOUD_TUNNEL_TOKEN", "OMB_CLOUD_VOICE_TOKEN",
+ "OMB_CLOUD_VOICE_URL", "OMB_CLOUD_X_TOKEN", "OMB_CLOUD_X_URL", "OMB_CODEX_LAUNCH_SLOTS", "OMB_COMPANION_DIR",
+ "OMB_COMPANION_HOSTED_URL", "OMB_COMPANION_INTERNAL_ORIGIN", "OMB_COMPANION_PORT", "OMB_COMPANION_ROUTES",
+ "OMB_COMPANION_TAILNET_NAME", "OMB_COMPOSIO_API", "OMB_COMPOSIO_BROKER", "OMB_COMPOSIO_BROKER_TOKEN",
+ "OMB_COMPOSIO_BROKER_URL", "OMB_COMPOSIO_TOOLKITS_API", "OMB_COMPUTER_CALL_ACT_WITHIN_MS",
+ "OMB_COMPUTER_CALL_WAIT_MS", "OMB_COMPUTER_WAIT_MAX_MS", "OMB_CONTROL_PLANE_URL", "OMB_CONTROL_PORT",
+ "OMB_CREDENTIAL_STORE", "OMB_CUSTOM_IMAGE_KEY", "OMB_DATA_DIR", "OMB_DECISION_RETENTION_DAYS",
+ "OMB_DEEPSEEK_API_KEY", "OMB_DESKTOP_LAUNCH_ID", "OMB_DESKTOP_PARENT", "OMB_DEVS_STATUS_MS",
+ "OMB_DEV_TRUST_LOCAL_BROWSER", "OMB_DISABLE_MODEL_CATALOG_FETCH", "OMB_DUCKDB_DIR", "OMB_DUCKDB_MAX_TEMP_SIZE",
+ "OMB_DUCKDB_MEMORY_LIMIT", "OMB_ELEVENLABS_API", "OMB_ENTERPRISE_DIR", "OMB_ENVIRONMENT_LABEL", "OMB_EOF",
+ "OMB_FIRST_REPLY_NOTICE_MS", "OMB_FISH_AUDIO_API", "OMB_FISH_AUDIO_API_KEY", "OMB_FLEET_SOCKET", "OMB_GATE_",
+ "OMB_GEMINI_API_KEY", "OMB_GEMINI_IMAGE_KEY", "OMB_GEMINI_TTS_API", "OMB_GOAL_WAIT_MAX_MS",
+ "OMB_GREENFERENCE_API_KEY", "OMB_GROQ_API_KEY", "OMB_HELPER_INSTANCE", "OMB_HELPER_MODEL", "OMB_HOOKS", "OMB_HOOK_",
+ "OMB_HOSTED_", "OMB_HOSTED_MODELS", "OMB_HOSTED_MODEL_TOKEN", "OMB_HOSTED_MODEL_URL", "OMB_INSTALLATION_CREDENTIAL",
+ "OMB_JEV_API_KEY", "OMB_LAN", "OMB_LICENSE_KEY", "OMB_LINUX_GPU", "OMB_LIVE_PROVIDER", "OMB_LOCAL_VM_UPDATE_WAIT_MS",
+ "OMB_LOOPBACK_TRUST", "OMB_LOOP_GUARD", "OMB_LOOP_GUARD_STOP_AT", "OMB_META_API_KEY", "OMB_MODELGO_API_KEY", "OMB_OPENAI_API_KEY",
+ "OMB_OPENAI_IMAGE_KEY", "OMB_OPENAI_LIVE_KEY", "OMB_OPENAI_LIVE_URL", "OMB_OPENROUTER_API_KEY",
+ "OMB_OPENROUTER_DECIDER_KEY", "OMB_PERSON_FIRST_MS", "OMB_PHONE_SECRET_PUBLIC_KEY", "OMB_PORT", "OMB_POSTIZ_API_KEY",
+ "OMB_POSTIZ_CLOUD_URL", "OMB_PROCESS_ID", "OMB_PUBLIC_IPV4", "OMB_PUBLIC_URL", "OMB_QUOTA_SWITCH",
+ "OMB_REPLAY_TOOL_HISTORY", "OMB_ROOM_SESSIONS", "OMB_SAFETY_FLOOR", "OMB_SERVER_COMPILE_CACHE", "OMB_SERVER_NAME",
+ "OMB_SESSION_IDLE_MIN_MS", "OMB_SESSION_IDLE_MS", "OMB_SESSION_MAX_DAYS", "OMB_SESSION_TTL_DAYS",
+ "OMB_SHARED_WORKSPACE_FULL_ACCESS", "OMB_SIGNIN_EMAILS", "OMB_SIGNIN_MEMBER_EMAILS", "OMB_SIGNIN_SMTP_FROM",
+ "OMB_SIGNIN_SMTP_URL", "OMB_SKILLS_DIR", "OMB_SMOKE_BUNDLED_CUA", "OMB_SMOKE_CUA", "OMB_SMOKE_KEEP_OPEN",
+ "OMB_SMOKE_TEST", "OMB_SSE_HEARTBEAT_MS", "OMB_STATIC_DIR", "OMB_SYNC_ROOT", "OMB_TEAM_AWAY_WINDOW_MS",
+ "OMB_TEAM_PRESENCE_GRACE_MS", "OMB_TEST_INTERNAL_CAPABILITY_KEY", "OMB_TEST_ORG_LIBRARY_KEY",
+ "OMB_TEST_PLAN_USAGE_FILE", "OMB_TOOL_STALL_MS", "OMB_TREG_KEY", "OMB_TREG_URL", "OMB_TTS_DEFAULT_VOICE",
+ "OMB_TTS_KEY", "OMB_TUNNEL_ORIGIN_PORT", "OMB_TUNNEL_SOCKET", "OMB_TURN_STALL_MS", "OMB_UPDATE_INSTALL",
+ "OMB_USER_DATA", "OMB_WARM_SUMMARY", "OMB_WARM_SUMMARY_TIME_SCALE", "OMB_WEBHOOK_PORT", "OMB_WEBHOOK_PUBLIC_URL",
+ "OMB_WORKERS_AI_TOKEN", "OMB_XAI_TTS_API",
+]);
+
+const ROOT = new URL("../../", import.meta.url);
+
+/** The `OMB_` names in the code the server runs, and in what starts it (the desktop app). */
+function knownOmbNames(): string[] {
+ const files = execFileSync("git", ["ls-files", "server", "shared", "enterprise/server", "electron"], { cwd: ROOT, encoding: "utf8" })
+ .split("\n").filter((file) => /\.(?:ts|mts|mjs|cjs|js)$/.test(file) && !/\.test\.|\/testing\/|node-test/.test(file));
+ const names = new Set<string>();
+ for (const file of files) for (const match of readFileSync(new URL(file, ROOT), "utf8").matchAll(/\bOMB_[A-Z0-9_]+\b/g)) names.add(match[0]);
+ return [...names].sort();
+}
describe("the box's environment allow-list", () => {
it("keeps what an engine needs and drops the server's own settings and the control plane", () => {
@@ -19,15 +85,28 @@ describe("the box's environment allow-list", () => {
]);
});
- it("a denied name loses even against an allowing prefix, and the never-list beats everything", () => {
- expect(boxEnvironmentAllows("OMB_COMPOSIO_BROKER_TOKEN")).toBe(true);
- expect(boxEnvironmentAllows("OMB_COMPOSIO_BROKER_TOKEN", new Set(["OMB_COMPOSIO_BROKER_TOKEN"]))).toBe(false);
+ it("a denied name loses even against an allowing list or prefix, and the never-list beats everything", () => {
+ expect(boxEnvironmentAllows("OMB_COMMS_TOKEN")).toBe(true);
+ expect(boxEnvironmentAllows("OMB_COMMS_TOKEN", new Set(["OMB_COMMS_TOKEN"]))).toBe(false);
+ expect(boxEnvironmentAllows("ANTHROPIC_API_KEY", new Set(["ANTHROPIC_API_KEY"]))).toBe(false);
+ expect(boxEnvironmentAllows("OMB_COMPOSIO_BROKER_TOKEN")).toBe(false);
for (const name of BOX_ENV_NEVER) expect(boxEnvironmentAllows(name), name).toBe(false);
expect(boxEnvironmentAllows("OMB_CLOUD_ANYTHING")).toBe(false);
- expect(boxEnvironmentAllows("OMB_CLOUDFLARED_PATH")).toBe(true);
+ expect(boxEnvironmentAllows("OMB_CLOUDFLARED_PATH")).toBe(false);
expect(BOX_ENV_NAMES.has("PATH")).toBe(true);
});
+ // The CLI's session token and server address (server/headless/client.ts, scripts/mcp-server.ts): an operator may put
+ // them in the server's environment, and nothing that runs in a box reads them. The engines' own OPENMAUSBOT_ keys
+ // (OPENMAUSBOT_CODEX_API_KEY, OPENMAUSBOT_CHATGPT_TOKEN) still pass, and a spawn's allowEnv never lifts these two.
+ it("keeps the CLI's session token and server address on the server, and the engines' OPENMAUSBOT_ keys in the box", () => {
+ const kept = boxEnvironment(
+ { OPENMAUSBOT_TOKEN: "omb_sess_x", OPENMAUSBOT_URL: "http://127.0.0.1:8799", OPENMAUSBOT_CODEX_API_KEY: "k", OPENMAUSBOT_CHATGPT_TOKEN: "t" },
+ new Set(), new Set(["OPENMAUSBOT_TOKEN", "OPENMAUSBOT_URL"]),
+ );
+ expect(Object.keys(kept).sort()).toEqual(["OPENMAUSBOT_CHATGPT_TOKEN", "OPENMAUSBOT_CODEX_API_KEY"]);
+ });
+
it("keeps what Antigravity's runtime is started with: its harness, its file storage switch and the browser hook", () => {
for (const name of ["ANTIGRAVITY_HARNESS_PATH", "AGY_ACP_FORCE_FILE_STORAGE", "BROWSER", "GEMINI_HOME"]) expect(boxEnvironmentAllows(name), name).toBe(true);
});
@@ -45,6 +124,23 @@ describe("the box's environment allow-list", () => {
.toEqual(["NANO_GPT_API_KEY"]);
});
+ it("passes only the OMB_ names a boxed process reads; an operator's own settings stay on the server", () => {
+ const kept = boxEnvironment({
+ OMB_SIGNIN_SMTP_URL: "smtp://user:[email protected]", OMB_SIGNIN_EMAILS: "[email protected]", OMB_PHONE_SECRET_PUBLIC_KEY: "k",
+ OMB_TEST_INTERNAL_CAPABILITY_KEY: "k", OMB_PUBLIC_URL: "https://x", OMB_SOMETHING_NEW: "x", OMB_EXTRA_PATH: "/opt/tools/bin",
+ OMB_MCP_TOKEN_BROWSER: "t", OMB_GATE_CONFIG_ab12: "{}", OMB_REMOTE_MCP_CONFIG_cd34: "{}", OMB_HARNESS_URL: "http://127.0.0.1:8799",
+ });
+ expect(Object.keys(kept).sort()).toEqual(["OMB_EXTRA_PATH", "OMB_GATE_CONFIG_ab12", "OMB_HARNESS_URL", "OMB_MCP_TOKEN_BROWSER", "OMB_REMOTE_MCP_CONFIG_cd34"]);
+ });
+
+ it("every OMB_ name the server knows has a decision: passed to a bot's box or kept on the server", () => {
+ const passed = (name: string) => BOX_ENV_OMB_NAMES.has(name) || BOX_ENV_OMB_PREFIXES.includes(name);
+ const undecided = knownOmbNames().filter((name) => !passed(name) && !SERVER_ONLY_OMB.has(name));
+ expect(undecided, "add each to BOX_ENV_OMB_NAMES in env.ts if a bot's engine, hook or MCP proxy reads it, else to SERVER_ONLY_OMB here").toEqual([]);
+ expect([...BOX_ENV_OMB_NAMES].filter((name) => SERVER_ONLY_OMB.has(name))).toEqual([]);
+ for (const name of SERVER_ONLY_OMB) if (!name.endsWith("_")) expect(boxEnvironmentAllows(name), name).toBe(false);
+ });
+
it("returns a fresh object, never the caller's", () => {
const source = { PATH: "/usr/bin" };
const kept = boxEnvironment(source);
diff --git a/server/bot-box/env.ts b/server/bot-box/env.ts
index b0f6f4e35e..f0cdf2a3a3 100644
--- a/server/bot-box/env.ts
+++ b/server/bot-box/env.ts
@@ -13,18 +13,42 @@ export const BOX_ENV_NAMES: ReadonlySet<string> = new Set([
"GIT_AUTHOR_NAME", "GIT_AUTHOR_EMAIL", "GIT_COMMITTER_NAME", "GIT_COMMITTER_EMAIL",
]);
+/** OpenMausBot's own variables a boxed process reads: what the harness sets for a bot's engine, its hooks and the MCP
+ * proxies it starts. Security: no other `OMB_` name passes, whatever the operator set on the server (an SMTP URL, a
+ * token); env.test.ts lists every `OMB_` name the server knows, so a new one needs a decision. */
+export const BOX_ENV_OMB_NAMES: ReadonlySet<string> = new Set([
+ "OMB_HARNESS_URL", "OMB_BOT_ID", "OMB_THREAD_ID", "OMB_COMMS_TOKEN", "OMB_TURN_DEPTH", "OMB_EXTERNAL_RUNTIME",
+ "OMB_CHIEF_OF_STAFF", "OMB_MAUSBOT", "OMB_SKILL_AUTHORING_ENABLED", "OMB_MEMORY_ENABLED", "OMB_SHARED_COMPUTERS_ENABLED",
+ "OMB_VOICE_NOTES", "OMB_X_RESEARCH", "OMB_RESEARCH", "OMB_TEAM_PEOPLE", "OMB_COMPUTER_SELECTION", "OMB_ROOM",
+ "OMB_IMAGE_GENERATION", "OMB_MEETINGS", "OMB_AGENTS_TOOL_BRIDGE", "OMB_TOOL_LIMIT", "OMB_TOOL_SCHEMA_PROFILE",
+ "OMB_MCP_CONFIG", "OMB_MCP_RESTART", "OMB_MCP_RESULT_BUDGET",
+ "OMB_HOOK_URL", "OMB_HOOK_TOKEN_FILE", "OMB_HOOK_TIMEOUT_MS", "OMB_PERMISSION_TOOL_SCOPE",
+ "OMB_CONNECTOR_UPSTREAM_URL", "OMB_CONNECTOR_UPSTREAM_HEADERS", "OMB_CONNECTOR_TOKEN", "OMB_CONNECTOR_ALLOWED_TOOLS",
+ "OMB_CONNECTOR_SERVICE_SLUGS", "OMB_CONNECTOR_APP_TOOLS", "OMB_CONNECTOR_APP_TOOL_NAMES",
+ "OMB_GATE_NAME", "OMB_GATE_UPSTREAM", "OMB_GATE_BUDGET", "OMB_GATE_SPILL_DIR", "OMB_GATE_SPILL_HINT", "OMB_GATE_TOOL_SCOPE",
+ "OMB_GATE_DIRECTORY", "OMB_GATE_APPS", "OMB_REMOTE_MCP_SERVER", "OMB_REMOTE_MCP_DIRECTORY", "OMB_REMOTE_MCP_APPS",
+ "OMB_CONTROL_URL", "OMB_CONTROL_TOKEN", "OMB_COMPUTER_JOURNAL", "OMB_CUA_ARGS", "OMB_CUA_COMMAND", "OMB_CUA_PLATFORM",
+ "OMB_PHONE_TOKEN", "OMB_ADB_PATH", "OMB_RESOURCES_PATH", "OMB_CODEX_AUTH_SOCKET", "OMB_CODEX_AUTH_SECRET",
+ "OMB_COPILOT_MCP_CONFIG", "OMB_BROWSER_PROFILE", "OMB_BOX_PROBE", "OMB_EXTRA_PATH", "OMB_TEST_SEALED_PATH",
+]);
+/** Families of the same, one variable per server or kind: a harness MCP server's token, a gated or remote server's config. */
+export const BOX_ENV_OMB_PREFIXES: readonly string[] = ["OMB_MCP_TOKEN_", "OMB_GATE_CONFIG_", "OMB_REMOTE_MCP_CONFIG_"];
+
/** Prefixes of the engines' own settings and keys (T0b replaces the keys with per-turn broker tokens). */
export const BOX_ENV_PREFIXES: readonly string[] = [
- "LC_", "OMB_", "OPENMAUSBOT_", "NPM_CONFIG_", "npm_config_",
+ "LC_", "OPENMAUSBOT_", "NPM_CONFIG_", "npm_config_",
"ANTHROPIC_", "CLAUDE_", "CODEX_", "OPENAI_", "OPENCODE_", "OPENROUTER_", "GEMINI_", "GOOGLE_", "GROK_", "XAI_",
"MISTRAL_", "CEREBRAS_", "GROQ_", "GREENFERENCE_", "MODELGO_", "META_", "MINIMAX_", "KIMI_", "MOONSHOT_", "CURSOR_", "FACTORY_", "CLINE_", "HERMES_",
"MUSE_", "PI_", "DWEB_", "UNSLOTH_", "FAKE_CLAUDE_", "MCP_", "ANTIGRAVITY_", "AGY_",
];
-/** Never, whatever the allow-list says: the control plane's settings and secrets, and the server's own placement. */
+/** Never, whatever the allow-list says: the control plane's settings and secrets, and the server's own placement. The
+ * CLI's session token and server address (server/headless/client.ts) too: nothing in a box reads them, and one an
+ * operator set on the server would otherwise pass under the engines' OPENMAUSBOT_ prefix. */
export const BOX_ENV_NEVER: ReadonlySet<string> = new Set([
"OMB_LICENSE_KEY", "OMB_INSTALLATION_CREDENTIAL", "OMB_LOOPBACK_TRUST", "OMB_CLOUD_SECRETS_FD",
"OMB_DATA_DIR", "OMB_STATIC_DIR", "OMB_DUCKDB_DIR", "OMB_PORT", "OMB_WEBHOOK_PORT",
+ "OPENMAUSBOT_TOKEN", "OPENMAUSBOT_URL",
]);
export const BOX_ENV_NEVER_PREFIXES: readonly string[] = ["OMB_CLOUD_"];
@@ -35,6 +59,7 @@ export function boxEnvironmentAllows(name: string, deny: ReadonlySet<string> = n
if (BOX_ENV_NEVER.has(name) || BOX_ENV_NEVER_PREFIXES.some((prefix) => name.startsWith(prefix))) return false;
if (allow.has(name) && !name.startsWith("OMB_")) return true;
if (deny.has(name)) return false;
+ if (name.startsWith("OMB_")) return BOX_ENV_OMB_NAMES.has(name) || BOX_ENV_OMB_PREFIXES.some((prefix) => name.startsWith(prefix));
return BOX_ENV_NAMES.has(name) || BOX_ENV_PREFIXES.some((prefix) => name.startsWith(prefix));
}
diff --git a/server/bot-box/self-check.ts b/server/bot-box/self-check.ts
index 75ddf5e263..1b2eb7f14c 100644
--- a/server/bot-box/self-check.ts
+++ b/server/bot-box/self-check.ts
@@ -140,8 +140,9 @@ export async function runBoxSelfCheck(options: SelfCheckOptions): Promise<SelfCh
command: process.execPath, args: [options.probeScript ?? BOX_PROBE_SCRIPT], cwd, botId: "probe",
env: {
PATH: [engineBin, process.env.PATH].filter(Boolean).join(delimiter), HOME: home, LANG: process.env.LANG, TMPDIR: "/tmp",
- // What must not get in: a control-plane secret, a workspace credential and an unlisted name, each holding the marker.
- OMB_CLOUD_BOOTSTRAP_SECRET: marker, COMPOSIO_API_KEY: marker, SOME_OTHER_SECRET: marker,
+ // What must not get in: a control-plane secret, a workspace credential, an operator's own setting, the CLI's
+ // session token and an unlisted name, each holding the marker.
+ OMB_CLOUD_BOOTSTRAP_SECRET: marker, COMPOSIO_API_KEY: marker, OMB_SIGNIN_SMTP_URL: `smtp://user:${marker}@mail.invalid`, OPENMAUSBOT_TOKEN: marker, SOME_OTHER_SECRET: marker,
// The real-looking key the broker takes over; its upstream is the fixture server, which answers 200 only to the real key.
...(credentials ? { ANTHROPIC_API_KEY: brokerKey, ANTHROPIC_BASE_URL: `http://127.0.0.1:${serverPort}/v1` } : {}),
},