Skip to content

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

Workspace backups leave out the Bot API keys saved for teammates on other servers

milind-soni826db718d22e
diff --git a/server/workspace-backup-policy.test.ts b/server/workspace-backup-policy.test.ts
index 5730c27976..6946aa686e 100644
--- a/server/workspace-backup-policy.test.ts
+++ b/server/workspace-backup-policy.test.ts
@@ -73,6 +73,11 @@ describe("workspace backup data boundary", () => {
for (const path of ["mcp-oauth.json.md", "workspaces/bot/mcp-oauth.json"]) expect(excludedWorkspaceAuthPath(path)).toBe(false);
});
+ it("never exports or restores the Bot API keys saved for teammates on other servers", () => {
+ for (const path of ["remote-teammates.json", "remote-teammates.json.4242.05a7b3e0-1234-4abc-8def-0123456789ab.tmp"]) expect(excludedWorkspaceAuthPath(path)).toBe(true);
+ for (const path of ["remote-teammates.json.md", "remote-teammate-work.json", "workspaces/bot/remote-teammates.json"]) expect(excludedWorkspaceAuthPath(path)).toBe(false);
+ });
+
it("never exports the per-turn hook token directory, and only that directory", () => {
for (const path of ["hook-tokens", "hook-tokens/0123456789abcdef01234567.token", "sessions.json.open"]) expect(ephemeralWorkspaceTokenPath(path)).toBe(true);
for (const path of ["hook-tokens.md", "workspaces/bot/hook-tokens/notes.md", "attachments/api.token", "sessions.json.opened", "workspaces/bot/sessions.json.open"]) expect(ephemeralWorkspaceTokenPath(path)).toBe(false);
diff --git a/server/workspace-backup-policy.ts b/server/workspace-backup-policy.ts
index 63ac5ae8c7..e937591542 100644
--- a/server/workspace-backup-policy.ts
+++ b/server/workspace-backup-policy.ts
@@ -38,6 +38,8 @@ export function excludedWorkspaceAuthPath(path: string): boolean {
if (inSecretFolder(path)) return true;
if (/^command-allowlist\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)) return true;
if (/^mcp-oauth\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)) return true;
+ // Bot API keys saved for teammates on other servers stay on the server they were saved on, like any other credential.
+ if (/^remote-teammates\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)) return true;
// Saved website logins and their key never leave the computer they were saved on, nor does the key sealing webhook secrets.
if (/^(?:logins\.json\.enc|member-secrets\.json\.enc|logins-key|webhook-key)(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)) return true;
// A Cloud home's connected-apps installation: its connected accounts belong to it, so a copy would share them.