The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Security: smaller fixes from the audit's low findings
Adarsha7995d89cdb2
diff --git a/.gitignore b/.gitignoreindex 50e91e19..00a62366 100644--- a/.gitignore+++ b/.gitignore@@ -43,6 +43,10 @@ next-env.d.ts# local data (db, uploads, outputs)/data/+# local deploy notes: never part of this repo+/deploy/+/docs/deploy.md+# evaluation harness (scripts/eval): your own inputs, run results and the metrics venv stay local/scripts/eval/local//scripts/eval/results/diff --git a/next.config.ts b/next.config.tsindex 6c4fdae6..077fc063 100644--- a/next.config.ts+++ b/next.config.ts@@ -3,6 +3,7 @@ import type { NextConfig } from "next";const nextConfig: NextConfig = {/* config options here */cacheComponents: true,+ poweredByHeader: false,partialPrefetching: true,experimental: {// The sign-in proxy holds every request body it sees in memory, up to this size, even one it refuses: a small limit@@ -14,6 +15,13 @@ const nextConfig: NextConfig = {},async headers() {return [+ // Pages: a fixed policy that holds without nonces (pages are prerendered): no plugins, no <base> elsewhere, no+ // framing by other sites, forms post only here. Stored files (/api/files, a share's /s/<token>/f/) keep their own,+ // stricter policy (src/server/file-response.ts).+ {+ source: "/:path((?!api/|s/[^/]+/f/).*)",+ headers: [{ key: "Content-Security-Policy", value: "object-src 'none'; base-uri 'self'; frame-ancestors 'self'; form-action 'self'" }],+ },// Vendored scripts (public/vendor: the 3D viewer's meshopt decoder) keep their name across upgrades:// a day, then revalidated in the background.{ source: "/vendor/:path*", headers: [{ key: "Cache-Control", value: "public, max-age=86400, stale-while-revalidate=604800" }] },diff --git a/src/server/account-gpu.ts b/src/server/account-gpu.tsindex a1cd8062..53f8922e 100644--- a/src/server/account-gpu.ts+++ b/src/server/account-gpu.ts@@ -65,10 +65,10 @@ export interface GpuInfo {}/** Ask the account's ComfyUI for /system_stats, the check the studio makes of its own. */-export async function testGpu(gpu: AccountGpu, o: { resolve?: (host: string) => Promise<string[]>; timeoutMs?: number } = {}): Promise<GpuInfo> {+export async function testGpu(gpu: AccountGpu, o: { resolve?: (host: string) => Promise<string[]>; timeoutMs?: number; maxBytes?: number } = {}): Promise<GpuInfo> {let res: Response;try {- res = await fetchPublic(`${gpu.url}/system_stats`, { headers: gpu.token ? { Authorization: `Bearer ${gpu.token}` } : {} }, { timeoutMs: o.timeoutMs ?? 10_000, deadlineMs: (o.timeoutMs ?? 10_000) + 5_000, maxBytes: 1 * 2 ** 20, resolve: o.resolve });+ res = await fetchPublic(`${gpu.url}/system_stats`, { headers: gpu.token ? { Authorization: `Bearer ${gpu.token}` } : {} }, { timeoutMs: o.timeoutMs ?? 10_000, deadlineMs: (o.timeoutMs ?? 10_000) + 5_000, maxBytes: o.maxBytes ?? 1 * 2 ** 20, resolve: o.resolve });} catch (e) {throw new GpuError(`Couldn't reach your ComfyUI at ${gpu.url}: ${(e as Error).message}`);}@@ -83,22 +83,38 @@ export async function testGpu(gpu: AccountGpu, o: { resolve?: (host: string) =>declare global {/** Each account's GPU as last asked (Your GPU: online or not, and what it is), for the status strip. */var __fuobeAccountGpus: Map<string, { url: string; at: number; online: boolean; info: GpuInfo }> | undefined;+ /** The checks on their way, one per account: status requests that arrive meanwhile wait for it. */+ var __fuobeAccountGpuChecks: Map<string, Promise<{ online: boolean } & GpuInfo>> | undefined;}-/** Is the account's ComfyUI answering, and what is it? Asked at most every 30 s per account. */+/** What a status check reads of /system_stats at most: a ComfyUI's answer is a few KB. */+const STATUS_MAX_BYTES = 64 * 1024;++/**+ * Is the account's ComfyUI answering, and what is it? Asked at most every 30 s per account, and one check at a time:+ * status requests that arrive while one is on its way share its answer.+ */export async function gpuState(id: string, gpu: AccountGpu): Promise<{ online: boolean } & GpuInfo> {const cache = (globalThis.__fuobeAccountGpus ??= new Map());const hit = cache.get(id);if (hit && hit.url === gpu.url && Date.now() - hit.at < 30_000) return { online: hit.online, ...hit.info };- let online = false;- let info: GpuInfo = hit?.url === gpu.url ? hit.info : {};- try {- info = await testGpu(gpu, { timeoutMs: 5000 });- online = true;- } catch {}- cache.set(id, { url: gpu.url, at: Date.now(), online, info });- if (cache.size > 5000) cache.delete(cache.keys().next().value!);- return { online, ...info };+ const checks = (globalThis.__fuobeAccountGpuChecks ??= new Map());+ const key = `${id} ${gpu.url}`;+ const going = checks.get(key);+ if (going) return going;+ const check = (async () => {+ let online = false;+ let info: GpuInfo = hit?.url === gpu.url ? hit.info : {};+ try {+ info = await testGpu(gpu, { timeoutMs: 5000, maxBytes: STATUS_MAX_BYTES });+ online = true;+ } catch {}+ cache.set(id, { url: gpu.url, at: Date.now(), online, info });+ if (cache.size > 5000) cache.delete(cache.keys().next().value!);+ return { online, ...info };+ })().finally(() => checks.delete(key));+ checks.set(key, check);+ return check;}/** What a visitor's status strip shows (GET /api/status): its own GPU, never the install's providers, servers or Demo mode. */diff --git a/src/server/auth.ts b/src/server/auth.tsindex afbb1908..82cbcd06 100644--- a/src/server/auth.ts+++ b/src/server/auth.ts@@ -69,23 +69,38 @@ interface AuthFile {accounts?: Account[];/** Settings → Security: guests may browse and anyone may sign up (FUOBE_PUBLIC_SIGNUP overrides it). */publicSignup?: boolean;+ /** In memory only: the file is there but can't be read or parsed. Sign-in stays on, nobody is signed in, nothing is written. */+ unreadable?: true;}let cache: { mtime: number; data: AuthFile } | null = null;+let warnedUnreadable = 0;+/**+ * The auth file. No file yet: no Settings password, no accounts (a new install). A file that is there but can't be read+ * or parsed fails closed: sign-in stays on with nobody signed in, never an open studio, and nothing writes over it.+ */function read(): AuthFile {try {const mtime = fs.statSync(FILE).mtimeMs;if (cache?.mtime === mtime) return cache.data;- const data = JSON.parse(fs.readFileSync(FILE, "utf8")) as AuthFile;+ const data = JSON.parse(fs.readFileSync(FILE, "utf8")) as AuthFile | null;+ if (!data || typeof data !== "object" || Array.isArray(data)) throw new Error("not an object");+ data.tokens ??= [];cache = { mtime, data };return data;- } catch {- return { secret: "", tokens: [] };+ } catch (e) {+ if ((e as NodeJS.ErrnoException).code === "ENOENT") return { secret: "", tokens: [] };+ if (Date.now() - warnedUnreadable > 60 * 60_000) {+ warnedUnreadable = Date.now();+ console.warn(`[fuobe] ${FILE} can't be read (${(e as Error).message}): sign-in stays on and nobody can sign in until it is fixed or restored.`);+ }+ return { secret: "", tokens: [], unreadable: true };}}function write(data: AuthFile): void {+ if (data.unreadable) throw new Error("The sign-in file (auth.json) can't be read. Fix or restore it: Fuobe won't write over it.");fs.mkdirSync(DATA_DIR, { recursive: true });const tmp = `${FILE}.${process.pid}.tmp`;fs.writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });@@ -101,12 +116,17 @@ const envPassword = () => process.env.FUOBE_PASSWORD || "";export function authStatus(): { enabled: boolean; fromEnv: boolean; tokens: Omit<ApiToken, "hash">[] } {const d = read();- return { enabled: !!(envPassword() || d.password), fromEnv: !!envPassword(), tokens: d.tokens.map(publicToken) };+ return { enabled: !!(envPassword() || d.password || d.unreadable), fromEnv: !!envPassword(), tokens: d.tokens.map(publicToken) };}const publicToken = (t: ApiToken): Omit<ApiToken, "hash"> => ({ id: t.id, name: t.name, prefix: t.prefix, createdAt: t.createdAt, lastUsedAt: t.lastUsedAt });-export const authEnabled = () => !!(envPassword() || read().password);+/** Sign-in is on: a password is set (FUOBE_PASSWORD or Settings), or the auth file can't be read (fail closed). */+export const authEnabled = () => {+ if (envPassword()) return true;+ const d = read();+ return !!(d.password || d.unreadable);+};// ---------------------------------------------------------------------------// Passwords@@ -348,8 +368,11 @@ export function accountsCsv(items = listAccounts()): string {export const accountById = (id: string): Account | undefined => read().accounts?.find((a) => a.id === id);-/** The account's own ComfyUI, or null when it hasn't connected one. */-export const accountGpu = (id: string): AccountGpu | null => accountById(id)?.gpu ?? null;+/** The account's own ComfyUI, or null when it hasn't connected one or the owner switched the account off. */+export const accountGpu = (id: string): AccountGpu | null => {+ const a = accountById(id);+ return a && !a.disabled ? (a.gpu ?? null) : null;+};function withoutGpu(a: Account): Account {const copy = { ...a };diff --git a/src/server/db.ts b/src/server/db.tsindex c79c27bd..faebdd86 100644--- a/src/server/db.ts+++ b/src/server/db.ts@@ -627,6 +627,13 @@ function open(): Database.Database {db.prepare("INSERT INTO _migrations (id) VALUES (?)").run(i);})();});+ // An account's own runs (its list, its active runs) are found through this index, not by reading every run. Not a+ // numbered migration, so branches that add migrations never clash over it; a failure only leaves lists slower.+ try {+ db.exec("CREATE INDEX IF NOT EXISTS generations_account ON generations(json_extract(request_json, '$.account'), created_at DESC)");+ } catch (e) {+ console.warn(`[fuobe] Couldn't index runs by account: ${(e as Error).message}`);+ }return db;}diff --git a/src/server/generations.ts b/src/server/generations.tsindex f104eab4..673f6ab0 100644--- a/src/server/generations.ts+++ b/src/server/generations.ts@@ -494,12 +494,14 @@ export function outputKind(op: Generation["op"], model: { kind: MediaKind }): Me// Live updates: every write to the table becomes an event (src/server/live.ts). A trashed row// (soft delete, when the table has one) leaves the feeds like a deleted one.+// The live feed is the owner's (accounts don't get it): an account's runs are never sent on it.setResolver((ids) =>- ids.map((id): LiveEvent => {+ ids.flatMap((id): LiveEvent[] => {const r = db().prepare("SELECT * FROM generations WHERE id = ?").get(id) as (Row & { deleted_at?: number | null; trashed_at?: number | null }) | undefined;+ if (r && accountOf(r)) return [];const g = r && (toGeneration(r) as Generation & { deletedAt?: number | null; trashedAt?: number | null });- if (!r || !g || r.deleted_at || r.trashed_at || g.deletedAt || g.trashedAt) return { type: "deleted", id, json: JSON.stringify({ id }) };- return { type: "generation", id, json: JSON.stringify(g) };+ if (!r || !g || r.deleted_at || r.trashed_at || g.deletedAt || g.trashedAt) return [{ type: "deleted", id, json: JSON.stringify({ id }) }];+ return [{ type: "generation", id, json: JSON.stringify(g) }];}),);diff --git a/src/server/library.ts b/src/server/library.tsindex 546c9e76..dd848ed7 100644--- a/src/server/library.ts+++ b/src/server/library.ts@@ -390,9 +390,12 @@ export interface LibraryFacets {reviews: Partial<Record<ReviewStatus, number>>;}-/** Counts for the Library's tabs and filters; helper steps are left out unless `steps` (as the lists do). */+/**+ * Counts for the owner's Library tabs and filters; helper steps are left out unless `steps` (as the lists do). Accounts'+ * runs are theirs, never counted here (public sign-up).+ */export function libraryFacets(opts: { steps?: boolean } = {}): LibraryFacets {- const all = "FROM generations g LEFT JOIN generation_trash t ON t.generation_id = g.id WHERE t.generation_id IS NULL";+ const all = "FROM generations g LEFT JOIN generation_trash t ON t.generation_id = g.id WHERE t.generation_id IS NULL AND json_extract(g.request_json, '$.account') IS NULL";const live = opts.steps ? all : `${all} AND NOT ${HELPER_SQL}`;const models = db().prepare(`SELECT g.model_id AS id, COUNT(*) AS n ${live} GROUP BY g.model_id ORDER BY n DESC`).all() as { id: string; n: number }[];const kinds = db().prepare(`SELECT g.kind AS kind, COUNT(*) AS n ${live} GROUP BY g.kind`).all() as { kind: MediaKind; n: number }[];diff --git a/src/server/remote-fetch.ts b/src/server/remote-fetch.tsindex bdee2886..d045ae91 100644--- a/src/server/remote-fetch.ts+++ b/src/server/remote-fetch.ts@@ -143,10 +143,37 @@ export function blockedForAccounts(ip: string): boolean {if (inner.wrapped) return true;const self = selfAddresses();if (self.has(canonical(ip)) || inner.v4.some((x) => self.has(x))) return true;- if (loopbackish(ip)) return true;+ if (loopbackish(ip) || linkLocalOrMetadata(ip) || inner.v4.some(linkLocalOrMetadata)) return true;return !allowPrivate() && isPrivateAddress(ip);}+/**+ * Link-local addresses and the clouds' metadata services (169.254.0.0/16, fe80::/10, Alibaba's 100.100.100.200, AWS's+ * fd00:ec2::254): never an account's GPU, whatever FUOBE_ALLOW_PRIVATE_URLS says. No tunnel or LAN server is there.+ */+function linkLocalOrMetadata(ip: string): boolean {+ if (net.isIPv4(ip)) {+ const [a, b] = v4(ip);+ return (a === 169 && b === 254) || ip === "100.100.100.200";+ }+ const h = hextets(ip);+ if (!h) return true;+ return (h[0] & 0xffc0) === 0xfe80 || canonical(ip) === canonical("fd00:ec2::254");+}++/**+ * The default check for links someone hands the owner's studio (fetchRemote): private and reserved networks (unless+ * FUOBE_ALLOW_PRIVATE_URLS=1), and always this machine's own public addresses, so a page can't steer the server into+ * fetching itself past the reverse proxy.+ */+export function blockedForLinks(ip: string): boolean {+ if (!allowPrivate() && isPrivateAddress(ip)) return true;+ const h = net.isIPv6(ip) ? hextets(ip) : null;+ const inner = h ? innerV4(h) : { v4: [] as string[], wrapped: false };+ const self = selfAddresses();+ return self.has(canonical(ip)) && !isPrivateAddress(ip) ? true : inner.v4.some((x) => self.has(x) && !isPrivateAddress(x));+}+/** Ports a stand-in ComfyUI may never use (the real ones on this machine, and the studio's own). */const RESERVED_PORTS = [8000, 8188, 8189, 8190, 8288, 3000, 3001];@@ -212,7 +239,7 @@ export async function fetchRemoteToFile(url: string, dest: string, o: RemoteFetcasync function download(url: string, o: RemoteFetchOptions, dest?: string): Promise<{ data?: Buffer; bytes: number; contentType: string | null; url: string }> {const maxBytes = o.maxBytes ?? MAX_REMOTE_BYTES;- const blocked = o.blocked ?? ((ip: string) => !allowPrivate() && isPrivateAddress(ip));+ const blocked = o.blocked ?? blockedForLinks;const resolve = o.resolve ?? (async (host: string) => (await dns.lookup(host, { all: true, verbatim: true })).map((a) => a.address));const deadline = Date.now() + (o.timeoutMs ?? 60_000);let current = new URL(url);diff --git a/tests/security-lows.test.ts b/tests/security-lows.test.tsnew file mode 100644index 00000000..6f09b59d--- /dev/null+++ b/tests/security-lows.test.ts@@ -0,0 +1,185 @@+import fs from "node:fs";+import http from "node:http";+import os from "node:os";+import path from "node:path";+import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";++const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-lows-"));+process.env.FUOBE_DATA_DIR = dir;+process.env.COMFYUI_URL = "http://127.0.0.1:9";+process.env.FUOBE_PUBLIC_SIGNUP = "1";+delete process.env.FUOBE_PASSWORD;+delete process.env.FUOBE_ALLOW_PRIVATE_URLS;+delete process.env.FUOBE_SELF_ADDRESSES;++const auth = await import("@/server/auth");+const { db } = await import("@/server/db");+const gens = await import("@/server/generations");+const { libraryFacets } = await import("@/server/library");+const live = await import("@/server/live");+const remote = await import("@/server/remote-fetch");+const { gpuState } = await import("@/server/account-gpu");+const nextConfig = (await import("../next.config")).default;++beforeAll(() => auth.setPassword("install password"));+afterEach(() => {+ delete process.env.FUOBE_ALLOW_PRIVATE_URLS;+ delete process.env.FUOBE_SELF_ADDRESSES;+ globalThis.__fuobeSelfAddresses = undefined;+ globalThis.__fuobeTestGpuPort = undefined;+});+afterAll(() => {+ try {+ fs.rmSync(dir, { recursive: true, force: true });+ } catch {}+});++/** A run of `account` (or the owner's), finished. */+function runOf(account?: string): string {+ const [g] = gens.createGenerations({ feature: "image", modelId: "fuobe-soul", prompt: "a fox", engine: "open" });+ db()+ .prepare("UPDATE generations SET status = 'succeeded', request_json = CASE WHEN ? IS NULL THEN request_json ELSE json_set(request_json, '$.account', ?) END WHERE id = ?")+ .run(account ?? null, account ?? null, g.id);+ return g.id;+}++describe("L-3: an account's GPU status is asked once at a time, and its answer is small", () => {+ let hits = 0;+ let body = JSON.stringify({ system: { comfyui_version: "1" }, devices: [{ name: "GPU", vram_total: 1 }] });+ let server: http.Server;+ let url = "";+ beforeAll(async () => {+ server = http.createServer((_req, res) => {+ hits++;+ setTimeout(() => res.end(body), 200);+ });+ await new Promise<void>((r) => server.listen(0, "127.0.0.1", r));+ url = `http://127.0.0.1:${(server.address() as { port: number }).port}`;+ });+ afterAll(() => new Promise<void>((r) => server.close(() => r())));++ it("sends one check for many status requests that arrive together", async () => {+ globalThis.__fuobeTestGpuPort = Number(new URL(url).port);+ hits = 0;+ const answers = await Promise.all(Array.from({ length: 20 }, () => gpuState("acct-l3", { url })));+ expect(answers.every((a) => a.online)).toBe(true);+ expect(hits).toBe(1);+ });++ it("reads at most 64 KB of the answer", async () => {+ globalThis.__fuobeTestGpuPort = Number(new URL(url).port);+ body = JSON.stringify({ system: { comfyui_version: "1" }, pad: "x".repeat(100 * 1024) });+ expect((await gpuState("acct-l3-big", { url })).online).toBe(false);+ });+});++describe("L-6: links the owner pastes never reach this server's own public address", () => {+ it("refuses this machine's public addresses, and still fetches other public ones", () => {+ process.env.FUOBE_SELF_ADDRESSES = "8.8.4.4";+ expect(remote.blockedForLinks("8.8.4.4")).toBe(true);+ expect(remote.blockedForLinks("8.8.8.8")).toBe(false);+ expect(remote.blockedForLinks("10.0.0.5")).toBe(true);+ // A LAN install that allows private addresses still may reach its LAN.+ process.env.FUOBE_ALLOW_PRIVATE_URLS = "1";+ expect(remote.blockedForLinks("10.0.0.5")).toBe(false);+ expect(remote.blockedForLinks("8.8.4.4")).toBe(true);+ });+});++describe("L-7: an account's GPU is never a link-local or cloud metadata address", () => {+ it("refuses them even where FUOBE_ALLOW_PRIVATE_URLS=1 lets LAN addresses through", () => {+ process.env.FUOBE_ALLOW_PRIVATE_URLS = "1";+ for (const ip of ["169.254.169.254", "169.254.0.1", "fe80::1", "100.100.100.200", "fd00:ec2::254"]) expect(remote.blockedForAccounts(ip), ip).toBe(true);+ expect(remote.blockedForAccounts("192.168.1.20")).toBe(false);+ });+});++describe("L-12: an account's list is read through an index", () => {+ it("has an index on the run's account", () => {+ const plan = db().prepare("EXPLAIN QUERY PLAN SELECT id FROM generations g WHERE json_extract(g.request_json, '$.account') = ?").all("x") as { detail: string }[];+ expect(plan.map((p) => p.detail).join(" ")).toMatch(/USING INDEX generations_account/);+ });+});++describe("L-13: the owner's Library counts and live feed leave accounts' runs out", () => {+ it("counts only the owner's runs", () => {+ const before = libraryFacets().total;+ runOf("someone-else");+ expect(libraryFacets().total).toBe(before);+ runOf();+ expect(libraryFacets().total).toBe(before + 1);+ });++ it("sends no live update for an account's run", async () => {+ const mine = runOf();+ const theirs = runOf("someone-else");+ const seen: string[] = [];+ const off = live.subscribe((e) => seen.push(e.id));+ try {+ db().prepare("UPDATE generations SET message = 'tick' WHERE id IN (?, ?)").run(mine, theirs);+ await new Promise((r) => setTimeout(r, 50));+ } finally {+ off();+ }+ expect(seen).toContain(mine);+ expect(seen).not.toContain(theirs);+ });+});++describe("L-14: a switched-off account's GPU is never used", () => {+ it("has no GPU while it is off", () => {+ const a = auth.createAccount("[email protected]", "long enough").id;+ auth.setAccountGpu(a, { url: "https://gpu.example.com" });+ expect(auth.accountGpu(a)).toEqual({ url: "https://gpu.example.com" });+ auth.setAccountDisabled(a, true);+ expect(auth.accountGpu(a)).toBeNull();+ auth.setAccountDisabled(a, false);+ expect(auth.accountGpu(a)).not.toBeNull();+ });+});++describe("L-16: pages carry a Content-Security-Policy, and no X-Powered-By", () => {+ it("sends a static policy on pages, never on stored files (they have their own)", async () => {+ expect(nextConfig.poweredByHeader).toBe(false);+ const rules = (await nextConfig.headers!()) as { source: string; headers: { key: string; value: string }[] }[];+ const csp = rules.filter((r) => r.headers.some((h) => h.key === "Content-Security-Policy"));+ expect(csp).toHaveLength(1);+ const value = csp[0].headers.find((h) => h.key === "Content-Security-Policy")!.value;+ for (const d of ["object-src 'none'", "base-uri 'self'", "frame-ancestors 'self'", "form-action 'self'"]) expect(value).toContain(d);+ // The source is a path-to-regexp pattern: "/:path(<regex>)".+ const re = new RegExp(`^/${/^\/:path\((.*)\)$/.exec(csp[0].source)![1]}$`);+ expect(re.test("/")).toBe(true);+ expect(re.test("/motions")).toBe(true);+ expect(re.test("/s/abc")).toBe(true);+ expect(re.test("/api/files/outputs/a.svg")).toBe(false);+ expect(re.test("/s/abc/f/outputs/a.svg")).toBe(false);+ });+});++describe("L-17: sign-in fails closed when the accounts file can't be read", () => {+ it("keeps sign-in on and never overwrites a file it couldn't read", () => {+ const file = path.join(dir, "auth.json");+ const good = fs.readFileSync(file, "utf8");+ const owner = auth.createSession().value;+ try {+ fs.writeFileSync(file, "{ not json");+ fs.utimesSync(file, new Date(), new Date(Date.now() + 10_000));+ expect(auth.authEnabled()).toBe(true);+ expect(auth.validSession(owner)).toBe(false);+ expect(() => auth.createAccount("[email protected]", "long enough")).toThrow();+ expect(fs.readFileSync(file, "utf8")).toBe("{ not json");+ } finally {+ fs.writeFileSync(file, good);+ fs.utimesSync(file, new Date(), new Date(Date.now() + 20_000));+ }+ expect(auth.validSession(owner)).toBe(true);+ });+});++describe("L-4: the local deploy notes can't be committed by accident", () => {+ it("git-ignores them", () => {+ const ignore = fs.readFileSync(path.join(import.meta.dirname, "..", ".gitignore"), "utf8").split(/\r?\n/);+ expect(ignore).toContain("/docs/deploy.md");+ expect(ignore).toContain("/deploy/");+ });+});