Skip to content

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

fix(auth): let members read instance capabilities so they can steer turns (#7792)

CI fixture1b5e01402cf2
diff --git a/server/request-auth.test.ts b/server/request-auth.test.ts
index 9f293f93e2..2f7bbe4f19 100644
--- a/server/request-auth.test.ts
+++ b/server/request-auth.test.ts
@@ -190,7 +190,7 @@ describe("scopes", () => {
["POST", "/api/bots/x/queue/q/steer"], ["POST", "/api/groups/g/queue/q/steer"],
] as const) expect(requiredScope(method, path), `${method} ${path}`).toBe("client");
for (const [method, path] of [
- ["POST", "/api/cli-test"], ["GET", "/api/cli-candidates"], ["GET", "/api/instances"], ["PATCH", "/api/instances/claude"],
+ ["POST", "/api/cli-test"], ["GET", "/api/cli-candidates"], ["PATCH", "/api/instances/claude"],
["POST", "/api/bots/x/computer/exec"], ["POST", "/api/bots/x/computer/join"], ["POST", "/api/local-computer/run"],
["POST", "/api/bots/x/local-computer/join"], ["POST", "/api/bots/x/local-computer/screenshot"],
["GET", "/api/computers/boxes"], ["POST", "/api/computers/boxes/bx_23456789/delete"],
@@ -217,6 +217,10 @@ describe("scopes", () => {
] as const) expect(requiredScope(method, path), `${method} ${path}`).toBe("admin");
});
+ it("lets any signed-in client read instance capabilities (queueing) so bots can be steered", () => {
+ expect(requiredScope("GET", "/api/instances")).toBe("client");
+ });
+
it("lets a Team Cloud member reach only their own connections; who connects what stays an admin's", () => {
for (const [method, path] of [
["GET", "/api/team/my-connections"], ["POST", "/api/team/my-connections/apps/gmail/connect"], ["DELETE", "/api/team/my-connections/apps/gmail"],
diff --git a/server/request-auth.ts b/server/request-auth.ts
index fb90caec59..b74edabee1 100644
--- a/server/request-auth.ts
+++ b/server/request-auth.ts
@@ -346,6 +346,8 @@ export const CLIENT_ALLOW: ReadonlyArray<{ methods: readonly string[]; path: Reg
{ methods: ["GET"], path: /^\/api\/bots$/ },
{ methods: ["GET"], path: /^\/api\/bots\/[\w-]+$/ },
{ methods: ["GET"], path: /^\/api\/team-map$/ },
+ // Members need instance capabilities (queueing) to steer running turns; the route itself requires only a valid session.
+ { methods: ["GET"], path: /^\/api\/instances$/ },
// a link into the organisation's Admin: identifiers only, and Admin authorizes its own visitor
{ methods: ["GET"], path: /^\/api\/bots\/[\w-]+\/slack-management$/ },
// what a bot made in the conversations this viewer can read, the same rows those conversations' messages show (routes/bot-library.ts)