Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(connectors): keep a bot's per-app scopes on the apps' sandbox at Full access (#5356)
Milind Sonif3b00bb86250
diff --git a/server/connector-advertisement.ts b/server/connector-advertisement.tsindex 6f2a60a89e..9f98632153 100644--- a/server/connector-advertisement.ts+++ b/server/connector-advertisement.ts@@ -24,7 +24,7 @@ export const CONNECTOR_META_TOOLS: readonly string[] = [];/** What a bot's tools/list offers: its grants, and the apps' sandbox's code tools while its turn runs at Full access (the- * relay judges each call again). */+ * relay judges each call again). The caller passes false for a bot with per-app scopes: the relay refuses it the sandbox. */export function advertisedGrants(grants: Record<string, ConnectorToolGrant> | undefined, fullAccess: boolean): Record<string, ConnectorToolGrant> | undefined {if (grants === undefined || !fullAccess) return grants;return { ...grants, [APP_SANDBOX_SERVICE]: { tools: [...APP_SANDBOX_TOOLS] } };diff --git a/server/trust-controls.e2e.test.ts b/server/trust-controls.e2e.test.tsindex a417936f0c..b162b98657 100644--- a/server/trust-controls.e2e.test.ts+++ b/server/trust-controls.e2e.test.ts@@ -539,6 +539,9 @@ it("runs sandbox code for a bot with app grants only at Full access, only by a dexpect(batched.body.result.isError).toBe(true);expect(JSON.stringify(batched.body.result)).toContain("only at Full access");expect(relayed).toHaveLength(before + 1);+ // Per-app scopes hold at Full access too: the code could reach Slack, which these scopes turn off.+ expect((await api("PATCH", `/api/bots/${b.id}`, { connectorScopes: { apps: { gmail: "write" } } })).status).toBe(200);+ expect((await relay(token, "COMPOSIO_REMOTE_WORKBENCH", code)).body.result.isError).toBe(true);expect((await api("PATCH", `/api/bots/${b.id}`, { connectorScopes: { apps: { gmail: "read" } } })).status).toBe(200);for (const name of ["COMPOSIO_REMOTE_WORKBENCH", "COMPOSIO_REMOTE_BASH_TOOL"]) {const limited = await relay(token, name, { code_to_execute: 'run_tool("GMAIL_SEND_EMAIL", {})' });