Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(doctor): check the Vault's own files and mcp-oauth.json for loose modes
DeryFerd9439adb87420
diff --git a/server/doctor/checks/secret-modes.test.ts b/server/doctor/checks/secret-modes.test.tsindex ebe44c08dd..f3eabc856d 100644--- a/server/doctor/checks/secret-modes.test.ts+++ b/server/doctor/checks/secret-modes.test.ts@@ -3,6 +3,7 @@ import { join } from "node:path";import { describe, expect, it } from "vitest";import { backupFolder, context, dataFolder, manifest, NOW } from "../../testing/doctor-folders.ts";+import { LOGINS_FILE, LOGINS_KEY_FILE, MEMBER_SECRETS_FILE } from "../../vault-store.ts";import { runDoctor } from "../run.ts";import { secretModesCheck } from "./secret-modes.ts";@@ -23,6 +24,15 @@ describe.skipIf(process.platform === "win32")("secret-modes check", () => {expect(readdirSync(backup)).toEqual(["manifest.json"]);expect(manifest(backup).entries).toEqual([{ check: "secret-modes", action: "made owner-only (0600); the old mode is here", path: join(data, "config.json"), mode: "0644" }]);});+it("covers the Vault's own key and blobs, and mcp-oauth.json, not only the settings files", () => {+ const data = dataFolder();+ const names = [LOGINS_KEY_FILE, LOGINS_FILE, MEMBER_SECRETS_FILE, "mcp-oauth.json"];+ for (const name of names) writeFileSync(join(data, name), "x");+ for (const name of names) chmodSync(join(data, name), 0o644);+ expect(secretModesCheck().check(context(data))).toMatchObject({ status: "problem" });+ expect(runDoctor({ dataDir: data, version: "9.9.9", mode: "start", fix: true, now: () => NOW, checks: [secretModesCheck()] }).checks[0]).toMatchObject({ status: "fixed" });+ for (const name of names) expect(statSync(join(data, name)).mode & 0o777, name).toBe(0o600);+ });});describe("secret-modes check on Windows", () => {diff --git a/server/doctor/checks/secret-modes.ts b/server/doctor/checks/secret-modes.tsindex 7eea711785..f2778deaa8 100644--- a/server/doctor/checks/secret-modes.ts+++ b/server/doctor/checks/secret-modes.ts@@ -9,6 +9,10 @@ import type { DoctorCheck } from "../types.ts";export const SECRET_FILES = ["config.json", "sessions.json", "bots.json", "groups.json", "messages.db", "webhooks.json", "tunnel-account.json", "browser-engine-key",+ // The Vault's own files: its key unseals every saved login, secret and TOTP seed, and the two blobs are those secrets.+ "logins-key", "logins.json.enc", "member-secrets.json.enc",+ // Plaintext OAuth tokens for the MCP servers a person signed in to.+ "mcp-oauth.json",] as const;type Loose = { name: string; path: string; mode: number };