Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Docs: sign-in and accounts notes in plain words

Adarsh716df41a47e6
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 8e724144..785f0ef7 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -383,7 +383,7 @@ runs beside ComfyUI, reached as a provider (see Providers).
- **Sign-in** is off until a password is set in Settings → Security or `FUOBE_PASSWORD`. State lives in SQLite, in `fuobe.db`'s `auth_*` tables (`AUTH_TABLES` in `src/server/db.ts`, read and written through `src/server/auth-store.ts`): a scrypt password hash, an HMAC secret for 30-day session cookies (replaced when the password changes), API tokens stored as SHA-256 hashes, signed-out cookies by their SHA-256, and with public sign-up (below) the accounts: one row each with a unique lower-case email and a scrypt hash, and their GPU links and sealed keys in rows of their own. Every check is a lookup by primary key or by the unique email. An older install's `data/auth.json` moves in on the first start, in one transaction that is checked row by row before it commits; for 10 minutes the file is then kept in step for a server of the older build that may still be running on the same folder, then kept as `auth.json.migrated-<time>`, with a note in its place that every older build reads as "sign-in on, nobody can sign in" (JSON with `unreadable: true` and a password hash no scrypt result matches). Going back to an older build goes through `scripts/auth-export.mjs`, which writes `auth.json` from the tables and marks the store `exported`; the next start moves that file back in, with the older build's changes, and bridges again. Any other `auth.json` found after the move (a backup copied back, a file from elsewhere) is never read as sign-in data and the site keeps serving from the tables: under the database's write lock it is linked to `auth.json.stray-<time>` (0600, through the file itself, never a symlink's target; a symlink is kept as a symlink), the note replaces `auth.json` by a rename only while `auth.json` is still that file (so it is never missing for an older build), and a row in `auth_stray_files` holds its counts and the ids of accounts only it lists. The owner sees the name and counts in Settings → Accounts and `signInNotices` of `GET /api/admin/accounts` while the file is there; the account sweep keeps the files of those accounts meanwhile. `FUOBE_AUTH_REIMPORT=1` moves such a file in instead (one whose data can't go in is set aside too). An `auth.json` that can't be read before the move keeps sign-in on with nobody signed in; one whose data can't go in, a database whose sign-in tables can't be used, or an export that comes back after the database changed make the proxy answer every request, `/login` too, with a calm "Back in a moment" page (503 with Retry-After, JSON for `/api/`), never the reason: the log has it. The proxy lets `/login` and `/api/auth/login` through (and, since round 4 part 4, GET and HEAD on a share link's page and files, checked by `openShare`: see Share links), answers other API calls with 401 and redirects pages to `/login?next=…` (`safeNext()` in `src/lib/safe-redirect.ts` keeps it on the same origin). Its matcher leaves out only build assets, `samples/`, `previews/`, `vendor/`, root SVGs and `/api/uploads` (which makes the proxy's checks itself: `src/server/direct-gate.ts`).
- **Public sign-up** (the owner's, on main; [`docs/public-signup.md`](public-signup.md) is the whole design). It is off by default and needs a password; `FUOBE_PUBLIC_SIGNUP` or Settings → Security turns it on. `src/lib/guest-access.ts` holds the path rules and `src/proxy.ts` applies them. Guests (signed out) read the pages and catalogs, and every change answers 401. Accounts see a guest view of the owner's library: a change to it or to a project answers 403 `library` (`LIBRARY_CHANGES`), and settings, keys and tokens are the owner's. Price checks stay open to both (`isPriceCheck`: the estimate routes in `ESTIMATES`, `?preview=1` on the run routes in `PREVIEWS`), and `priceAs` (`src/server/visitor.ts`) prices a visitor's run as it would go on its own GPU. The one run an account may start is `POST /api/generations` (`ownGpuRun`), on its own ComfyUI; without one connected, any run answers `connect-gpu`, and with one, every other tool answers `own-gpu-tool`. Round 5 part 2's tools follow these rules. `/api/turnaround?preview=1` is in `PREVIEWS` and `/api/turnaround/estimate` in `ESTIMATES`. Split soundtrack and its remux (`POST /api/audio-tools`), the turnaround and Cinema's `path` and `turnaround` actions answer a guest 401, an account without a GPU `connect-gpu`, and an account with one `own-gpu-tool`. Export mix (`POST /api/audio-tools/export`) is in `LIBRARY_CHANGES`, since it saves into the owner's Library. MOSS-Image runs for an account through `POST /api/generations` on its own ComfyUI, the only new tool an account can run. A turnaround that names a character (`elementId`) answers any visitor 404 "Character not found", whether or not it exists (`requestViewer`, `recordExists`). `tests/public-signup-tools.test.ts` (12 tests) checks these answers through the API; the browser checks ran with public sign-up off. Round 5 part 3 leaves `guest-access.ts` as it was, and its routes fall under the rules above. The new run paths (`POST /api/cinema/projects/[id]/items/[generationId]/finish`, Finish in 2K; `POST /api/shorts/sessions/[id]/segments/[index]/enhance`; the Faceless episode action `regenerate`; the tool `speech-edit` on `POST /api/audio-tools`) answer a guest 401 and an account `own-gpu-tool`, and Edit speech's `?preview=1` stays a price check, priced for the account's own GPU on its own file. Cinema (World mode included), Storyboard's one sheet, Layers' re-render, every 3D run (Hi3D, Idol's mesh and views) and the WorldCast worker stay the owner's: `worldcastContext` is undefined for a visitor, the worldcast provider refuses an account's run, and only the owner's project read carries `context.worldcast`. Kandinsky 6.0, Kandinsky VSR, Pika H3 Flex (References and Talk from a voice clip included), the keyers and RTX Video run for an account through `POST /api/generations` as any model does: an open model on its own ComfyUI and its inputs through the run's own file checks (Pika H3 Flex's and RTX Video's refusals to an account name no Setting or script). The four new fal routes aren't on `HOSTED_UNTESTED_ENDPOINTS` (`src/lib/catalog/hosted-untested.ts`) yet, so an account with its own fal key can run them before a live call has passed. With hosted runs on (`FUOBE_HOSTED_RUNS=1`), an RTX run on the install's GPUs is refused before any quote when the install's last GPU check says its card can't run it or its ComfyUI lacks the nodes (`poolCardRefuses` in `src/server/hosted-run.ts`), and a 2K take's finishes are checked against the pool's policy with its main step (`poolAllowsRun`).
- **Admin tokens** (`src/server/admin-tokens.ts`, [`docs/admin-api.md`](admin-api.md)): `fuobe_adm_…` tokens with scopes, stored in SQLite (`admin_tokens`, SHA-256 only) and made in Settings → Security from the owner's signed-in browser. The proxy lets one through only on `/api/admin/*` (not `/api/admin/tokens`, except `/self`); every admin route checks it with `adminAccess(request, scope)`, which checks a request by its admin token alone, and otherwise asks for the owner as before. `validToken()` never takes one. Per-token limits a minute (120 reads, 30 changes, 600 file views, each counted on its own) and a separate budget for wrong tokens. Changes, a token's reads and file views, and refusals go to `admin_audit` (kept a year). A worker token is made only with `workers:tokens`.
-- **Host allowlist** (`hostAllowed`), for every method when no password is set, before anything else: IP literals, localhost and `*.localhost`, single-label names, `.local` / `.lan` / `.home.arpa` / `.internal` / `.localdomain`, this machine's hostname, and `FUOBE_ALLOWED_ORIGINS` (`*` allows any). This stops DNS rebinding. `X-Forwarded-Host` is not trusted here.
+- **Host allowlist** (`hostAllowed`), for every method when no password is set, before anything else: IP literals, localhost and `*.localhost`, single-label names, `.local` / `.lan` / `.home.arpa` / `.internal` / `.localdomain`, this machine's hostname, and `FUOBE_ALLOWED_ORIGINS` (`*` allows any). `X-Forwarded-Host` isn't read here.
- **Cross-site writes** (`crossSite`): non-GET/HEAD/OPTIONS requests get 403 when `Origin` matches neither Host, `X-Forwarded-Host` nor `FUOBE_ALLOWED_ORIGINS`, when it is `null`, or when `Sec-Fetch-Site` is cross-site — with or without a password.
- **Login throttle** (`LoginGuard`): 5 misses per client and 20 a minute overall, bounded map, `Retry-After`. Route handlers can't see the socket address, so the client key is the last `X-Forwarded-For` hop only with `FUOBE_TRUST_PROXY=1` (then a 60 s lock per client); otherwise everyone shares a key that is slowed to one attempt every 4 s and never locked. Since round 4 part 4 the same client key drives `ShareGuard`, the throttle on wrong share tokens.
- **Remote fetch** (`fetchRemote`): every caller-supplied URL (references, brand research, product links, YouTube oEmbed, Assist sources) is fetched only from public addresses. The check runs inside the socket lookup (DNS can't change after it) and again on each of at most 5 redirects; it blocks loopback, RFC 1918, link-local / metadata, CGNAT, multicast, ULA and mapped / NAT64 / 6to4 IPv4. 60 s deadline, 200 MB cap. `fetchRemoteToFile` makes the same checks but streams to a file (16 GB cap, 30-minute deadline; a failed download leaves no file); it fetches the extra files a result links to. `FUOBE_ALLOW_PRIVATE_URLS=1` turns both off for LAN installs, and since round 4 part 4 also lets an Assist connector's URL use plain http beyond localhost (Fuobe never fetches a connector's URL itself: Anthropic's servers do).
diff --git a/docs/STATUS.md b/docs/STATUS.md
index b1d01265..7fa19068 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -306,7 +306,7 @@ Most important first.
**Library, data and security**
- "Move to" and "new folder" in the Library's selection bar still act on the whole selection, including results hidden by a search or filter; the count and the other actions follow the shown results.
- Without Web Locks (plain `http://` on a LAN IP) each visible tab reads its own live stream; six or more visible windows on one host could hit the browser's connection limit.
-- **Sign-in is off by default.** Without a password Fuobe answers only on local addresses and names in `FUOBE_ALLOWED_ORIGINS`, but anyone who can reach it can use it (and your keys). With a password, a page that rebinds DNS can still post password guesses; the throttle caps that at roughly 15–20 a minute. Without `FUOBE_TRUST_PROXY=1` behind a reverse proxy, all visitors share one throttle (slowed, never locked out). `comfyLorasDir` (now also where LoRAs are downloaded) and `aiToolkitDatasetDir` make the server write files where you point them. Save & test lets a signed-in caller make the server fetch a ComfyUI or local LLM server address without saving it (saving it already allowed the same). Share links skip sign-in by design (next bullet).
+- **Sign-in is off by default.** Without a password Fuobe answers only on local addresses and names in `FUOBE_ALLOWED_ORIGINS`. Set `FUOBE_PASSWORD` to ask everyone to sign in. Sign-in attempts are throttled to roughly 15–20 a minute (slowed, never locked out); behind a reverse proxy, set `FUOBE_TRUST_PROXY=1` so that each visitor gets a throttle of their own. `comfyLorasDir` (also where LoRAs are downloaded) and `aiToolkitDatasetDir` are the folders the server writes those files into. Save & test checks a ComfyUI or local LLM server address without saving it. Share links open without sign-in (next bullet).
- **Share links are public.** GET and HEAD on `/s/<token>` and its files pass without a session, even with a password set, after the host allowlist and the cross-site check. Set `FUOBE_PASSWORD` so the rest of the studio stays locked (the Share dialog warns if not): on a password-less install an outside visitor can open a link only if the host is in `FUOBE_ALLOWED_ORIGINS`, which opens the whole studio too. Only a SHA-256 of each token is stored. Wrong tokens get 404, and 429 past 100 a minute; behind a reverse proxy, `FUOBE_TRUST_PROXY=1` lets Fuobe lock out the client that guesses, and without it no one is locked out. The files route serves only what the share page shows, and blanks generation data with a hand-written cleaner (`src/server/media-clean.ts`): a bug there would leak metadata or hide a file.
- **Models & licences has no admin role:** anyone who can sign in, or holds an API token, can change the switches (`PUT /api/settings/models`); with no password, anyone who can reach the install.
- Assist connector tokens and URLs are stored in plain text in SQLite, like the other keys, and masked before they reach the browser.
diff --git a/docs/research/accounts-8.json b/docs/research/accounts-8.json
index a5a3e335..39ba6ec1 100644
--- a/docs/research/accounts-8.json
+++ b/docs/research/accounts-8.json
@@ -1291,7 +1291,7 @@
"mode": "core",
"effort": "large",
"dependsOn": [],
- "brief": "Sections: §7.1, §7.2 (password format), §7.9 (fresh installs), §7.15 (secret fingerprint), §7.16, §5.2 (version rule).\nFiles: package.json (better-auth exact, per §5.2 rule); new src/server/identity/{auth.ts, password.ts, principal.ts, bootstrap.ts, admin-ops.ts, refusals.ts}; src/server/mode.ts (features registry); src/server/backup/snapshot.ts; scripts/auth-schema.mjs; src/server/db.ts (migration 23 identity tables, 24 frozen Better Auth SQL); src/app/api/identity/[...all]/route.ts; shims src/app/api/auth/{login,logout,password,tokens}/route.ts; src/proxy.ts; src/instrumentation.ts (awaited bootstrap); next.config.ts headers().\nBehaviour: Better Auth configured exactly as §7.1: own better-sqlite3 connection, auth_* table names, HKDF secret from FUOBE_SECRET or data/secret.key, __Host- cookies on https via useSecureCookies:false plus per-cookie names, ipAddressHeaders x-fuobe-client-ip written by the proxy only when a trusted proxy is configured, disableIpTracking otherwise, cookieCache off, telemetry off. The router-only endpoint allowlist excludes /sign-up/*, /sign-in/social and /sign-in/oauth2/*; user.create.before refuses any create other than claim-owner and the bootstrap import unless accounts.multi_user=1 (not set by this package). Bootstrap: wal_checkpoint and a pre-accounts snapshot with session rows stripped; root secret and identity.secret_check (refuse to start on mismatch unless FUOBE_ACCEPT_NEW_SECRET=1); import the auth.json password as u_owner's (legacy salt:hash verifies, upgraded to scrypt$v2 N=2^15 r=8 p=3 on sign-in) and tokens as legacy Full tokens; sync FUOBE_PASSWORD every boot. A fresh data dir boots as personal, sign-in off, setup.state=done; a password install becomes Personal with sign-in. The proxy resolves bearer tokens from api_tokens and the Better Auth cookie, keeps DNS-rebinding, crossSite and share logic, and gains OPEN and CROSS_SITE_EXEMPT registries. The login shim signs u_owner in with one password field and answers with a full reload. Security headers: X-Frame-Options DENY and frame-ancestors 'none' except /s/:path*, no-store on auth pages.\nTests: identity-bootstrap matrix (no password, password, FUOBE_PASSWORD, tokens, fresh dir); schema guard (getMigrations finds nothing to create or add); allowlist (router-only; auth.api passes; POST /api/identity/sign-up/email answers 403 and creates no auth_user row); password formats and upgrade; proxy matrix (Just me, password install, bearer, cookie, share link); security headers; snapshot has no auth_session rows; fingerprint mismatch refuses start; admin-ops reachability pin; Better Auth behaviour pins (cookie names and attributes on http and https, disableIpTracking skips IP rules, request scope inside hooks, returnHeaders); 50 sign-ins during runner writes with busy waits under 1 s.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every existing Vitest suite (FUOBE_MODE=personal default); the eval harness; the only visible change is one re-sign-in on password installs."
+ "brief": "Sections: §7.1, §7.2 (password format), §7.9 (fresh installs), §7.15 (secret fingerprint), §7.16, §5.2 (version rule).\nFiles: package.json (better-auth exact, per §5.2 rule); new src/server/identity/{auth.ts, password.ts, principal.ts, bootstrap.ts, admin-ops.ts, refusals.ts}; src/server/mode.ts (features registry); src/server/backup/snapshot.ts; scripts/auth-schema.mjs; src/server/db.ts (migration 23 identity tables, 24 frozen Better Auth SQL); src/app/api/identity/[...all]/route.ts; shims src/app/api/auth/{login,logout,password,tokens}/route.ts; src/proxy.ts; src/instrumentation.ts (awaited bootstrap); next.config.ts headers().\nBehaviour: Better Auth configured exactly as §7.1: own better-sqlite3 connection, auth_* table names, HKDF secret from FUOBE_SECRET or data/secret.key, __Host- cookies on https via useSecureCookies:false plus per-cookie names, ipAddressHeaders x-fuobe-client-ip written by the proxy only when a trusted proxy is configured, disableIpTracking otherwise, cookieCache off, telemetry off. The router-only endpoint allowlist excludes /sign-up/*, /sign-in/social and /sign-in/oauth2/*; user.create.before refuses any create other than claim-owner and the bootstrap import unless accounts.multi_user=1 (not set by this package). Bootstrap: wal_checkpoint and a pre-accounts snapshot with session rows stripped; root secret and identity.secret_check (refuse to start on mismatch unless FUOBE_ACCEPT_NEW_SECRET=1); import the auth.json password as u_owner's (legacy salt:hash verifies, upgraded to scrypt$v2 N=2^15 r=8 p=3 on sign-in) and tokens as legacy Full tokens; sync FUOBE_PASSWORD every boot. A fresh data dir boots as personal, sign-in off, setup.state=done; a password install becomes Personal with sign-in. The proxy resolves bearer tokens from api_tokens and the Better Auth cookie, keeps the host allowlist, crossSite and share logic, and gains OPEN and CROSS_SITE_EXEMPT registries. The login shim signs u_owner in with one password field and answers with a full reload. Security headers: X-Frame-Options DENY and frame-ancestors 'none' except /s/:path*, no-store on auth pages.\nTests: identity-bootstrap matrix (no password, password, FUOBE_PASSWORD, tokens, fresh dir); schema guard (getMigrations finds nothing to create or add); allowlist (router-only; auth.api passes; POST /api/identity/sign-up/email answers 403 and creates no auth_user row); password formats and upgrade; proxy matrix (Just me, password install, bearer, cookie, share link); security headers; snapshot has no auth_session rows; fingerprint mismatch refuses start; admin-ops reachability pin; Better Auth behaviour pins (cookie names and attributes on http and https, disableIpTracking skips IP rules, request scope inside hooks, returnHeaders); 50 sign-ins during runner writes with busy waits under 1 s.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every existing Vitest suite (FUOBE_MODE=personal default); the eval harness; the only visible change is one re-sign-in on password installs."
},
{
"key": "acc-2",
diff --git a/docs/research/accounts-8.md b/docs/research/accounts-8.md
index 44d63175..ea224cc6 100644
--- a/docs/research/accounts-8.md
+++ b/docs/research/accounts-8.md
@@ -52,7 +52,7 @@ One codebase, one core; the mode decides what is on, and the mode can change lat
- **Sessions are stateless.** Cookie `fuobe_session` (L19) = `<expiry>.<HMAC(secret, expiry)>`, valid 30 days (L20, L107–125). There is no user id, no session table and no per-session revocation. Logout only deletes the cookie (`src/app/api/auth/logout/route.ts` L4–7). Changing the password rotates the secret and signs every browser out (L97–102).
- **Login throttle** (`LoginGuard`, L214–265): per client only behind `FUOBE_TRUST_PROXY=1`; otherwise every client shares one "direct" key (one try per 4 s, never locked), plus a global 20 a minute. It throttles but never lets anyone lock the owner out.
- **API tokens** are `fuobe_` + 24 random bytes; only the SHA-256 and a 12-character prefix are stored (L270–278). They have no owner, scope or expiry, and are created only from a signed-in browser (`src/app/api/auth/tokens/route.ts` L5–9).
-- **The proxy** (`src/proxy.ts`, Node runtime by default per `proxy.md` L253–255): (a) a DNS-rebinding host check only when no password is set (L88–94, `hostAllowed` L190–200, which accepts `*`, L198); (b) a cross-site write block (`crossSite` L152–166); (c) public share links `/s/<token>` for GET and HEAD (L49–75), where any signed-in session counts as "the owner" (L50); (d) everything open without a password (L103); (e) `OPEN = {"/login", "/api/auth/login"}` (L10); (f) signed in = a valid cookie or bearer token (L35). It also 404s unknown record ids through `recordExists` (L21–28), a primary-key lookup.
+- **The proxy** (`src/proxy.ts`, Node runtime by default per `proxy.md` L253–255): (a) a host allowlist when no password is set (L88–94, `hostAllowed` L190–200, which accepts `*`, L198); (b) a cross-site write block (`crossSite` L152–166); (c) public share links `/s/<token>` for GET and HEAD (L49–75), where any signed-in session counts as "the owner" (L50); (d) everything open without a password (L103); (e) `OPEN = {"/login", "/api/auth/login"}` (L10); (f) signed in = a valid cookie or bearer token (L35). It also 404s unknown record ids through `recordExists` (L21–28), a primary-key lookup.
- **No route handler checks anything itself.** All 192 `route.ts` files trust the proxy. There are no Server Actions (`git grep "use server"` finds none). The bundled Next 16 guide says the proxy is for optimistic checks only (`authentication.md` L1121) and route handlers are public endpoints (L1507).
### 3.2 Data: 43 tables, none owned
@@ -182,7 +182,7 @@ Sources: docs.openwebui.com (roles, groups, hardening, SSO, SCIM, password reset
**Chosen: better-auth for authentication only.** MIT (still MIT after Vercel's acquisition, announced 2026-07-07), peers `next ^16` and `react ^19`, runs on better-sqlite3 through Kysely and emits SQL Fuobe freezes into `MIGRATIONS`, has fail-closed hooks (`validateUserInfo`, `databaseHooks`, `hooks.before/after`) and a custom password hasher. Fuobe never loads its `organization`, `admin`, `api-key`, `magic-link`, `oauth-proxy`, `one-tap`, `anonymous`, `device-authorization`, `jwt`, `bearer`, `multi-session` or `username` plugins: Fuobe's DAL needs synchronous membership reads, and several of those plugins carried 2026 advisories.
-Its advisory list is long (OSV, 26 entries on 2026-10-29; critical ones include GHSA-965c-763c-88jm OAuth state used as a magic link, GHSA-rjg6-39jm-rgg4 SCIM provider collision, GHSA-5rr4-8452-hf4v SSO SSRF and GHSA-xg6x-h9c9-2m83 a 2FA bypass with the cookie cache). Conditions: every `@better-auth/*` package at the same exact version, an OSV watch that blocks releases, a router-only endpoint allowlist (§7.1), `cookieCache` off, its own database connection and a schema-guard test.
+It publishes its advisories through OSV. Conditions: every `@better-auth/*` package at the same exact version, an OSV watch that blocks releases, a router-only endpoint allowlist (§7.1), `cookieCache` off, its own database connection and a schema-guard test.
**Version rule (applied when each package starts, not today):** pin the newest release that is at least 14 days old and OSV-clean; if every release that old has an open advisory, pin the oldest release that fixes all of them. Re-checked on 2026-10-29:
@@ -204,7 +204,7 @@ Unchanged: next 16.4.2, react 19.3.0, better-sqlite3 ^13.0.3, zod ^4.6.7, nanoid
### 5.3 Standards that set the rules
-- **OWASP ASVS 5.0** (`/home/user/ext/owasp-asvs`, `9ccce0e`): passwords of 8+ characters with 64+ allowed and no composition rules (6.2.1, 6.2.5, 6.2.9), a blocklist of at least the top 3,000 passwords (6.2.4), every authentication path equally strong (6.3.4), reset must not bypass MFA (6.4.3), admins initiate a reset but never know the password (6.4.6), lookup codes single-use (6.5.1), accounts keyed by issuer and subject (6.8.1); sessions revoked on the backend at logout, disable and delete (7.4.1, 7.4.2), people see and end their sessions (7.5.2); data-specific authorization against IDOR (8.2.2), authorization on the originating user (8.3.3), cross-tenant controls (8.4.1); every authentication attempt and failed authorization logged without secrets (16.3.1, 16.3.2, 16.2.5); scrypt N ≥ 2^17 with r=8 p=1, or the OWASP table's N=2^15 r=8 p=3 (Appendix C).
+- **OWASP ASVS 5.0** (`/home/user/ext/owasp-asvs`, `9ccce0e`): passwords of 8+ characters with 64+ allowed and no composition rules (6.2.1, 6.2.5, 6.2.9), a blocklist of at least the top 3,000 passwords (6.2.4), every authentication path equally strong (6.3.4), a reset keeps MFA (6.4.3), admins initiate a reset but never know the password (6.4.6), lookup codes single-use (6.5.1), accounts keyed by issuer and subject (6.8.1); sessions revoked on the backend at logout, disable and delete (7.4.1, 7.4.2), people see and end their sessions (7.5.2); data-specific authorization against IDOR (8.2.2), authorization on the originating user (8.3.3), cross-tenant controls (8.4.1); every authentication attempt and failed authorization logged without secrets (16.3.1, 16.3.2, 16.2.5); scrypt N ≥ 2^17 with r=8 p=1, or the OWASP table's N=2^15 r=8 p=3 (Appendix C).
- **NIST SP 800-63B-4** (final, 31 July 2025): 15+ characters for single-factor passwords or 8+ with MFA, no composition rules, a blocklist, no periodic changes, paste allowed, at most 100 consecutive failures per account; synced passkeys acceptable at AAL2 when user verification is set.
- **OWASP cheat sheets** (Forgot Password, Session Management, Authorization, IDOR, Credential Stuffing, MFA, SAML): uniform answers and timing, hashed single-use reset tokens built from a configured base URL, `__Host-` cookies, deny by default, scoped lookups, and never hand-rolled SAML.
- **WebAuthn Level 3** (W3C Recommendation, 25 August 2026): passkey autofill with `autocomplete="username webauthn"` and conditional mediation; the RP ID must be a real domain, so passkeys need an https site address or localhost.
@@ -602,7 +602,7 @@ Existing variables keep their meaning (`FUOBE_PASSWORD`, `FUOBE_ALLOWED_ORIGINS`
**Personal settings:** `install.signin` (off after Just me, on after Create an account or `FUOBE_PASSWORD`), `install.site_url`, `access.allowed_hosts`, `access.trust_proxy`, `security.sign_in_alerts` (on), `security.trust_device_days` (30), `backup.schedule` / `keep` / `dir` (weekly, 4, `data/backups`), `shares.public` (anyone or nobody).
-**Personal threats and answers:** Just me reached by others (honest copy, the banner, the bind hint, the tunnel refusal); password guessing (throttles, the password-only lock, passkeys, recovery); passkey origin confusion (explicit origin and RP ID); two-step bypass (no cookie cache, restricted sessions after OAuth, email resets keep two-step); a lost root secret (fingerprint check, key carried in snapshots); recovery abuse (60-bit code, 5 tries, fragment only, Strict cookie); backup leakage (step-up, single-use download tickets, no sessions inside); CLI phishing (code, IP and user agent shown, fresh session, 10 minutes).
+**Personal protections:** a server others can reach: honest copy, the banner, the bind hint, the tunnel refusal; sign-in: throttles, the password-only lock, passkeys, recovery; passkeys: an explicit origin and RP ID; two-step: no cookie cache, restricted sessions after OAuth, email resets keep two-step; the root secret: a fingerprint check, the key carried in snapshots; recovery: a 60-bit code, 5 tries, fragment only, a Strict cookie; backups: step-up, single-use download tickets, no sessions inside; the CLI: code, IP and user agent shown, a fresh session, 10 minutes.
## 9. Mode 2: In-house studio
@@ -614,7 +614,7 @@ Existing variables keep their meaning (`FUOBE_PASSWORD`, `FUOBE_ALLOWED_ORIGINS`
- **The Studio default follows the owner: open.** `/setup/join` preselects "Anyone can create an account" with "Only these email domains" prefilled with the owner's work domain (empty when the owner's email is webmail, with the line "Anyone who can reach {site} can join and spend up to the monthly limit on the studio's keys."). Open requires checked addresses: an email code (needs a working mail transport) or Google/OIDC as the only methods. Without either, Open is disabled with "Open sign-up needs email or Google sign-in so we can check addresses. Until then, you approve each person." and the step preselects "I approve new accounts". The server enforces the same rule.
- **Domain trust applies only to checked addresses** (reviews 1 and 4). Domain auto-approve, domain capture and team auto-join apply only to emails Fuobe verified with a code, or asserted (with `email_verified`) by the company sign-in connection bound to that domain. Without a mail transport, "People at these domains join without approval" is disabled, and "Use recommended settings" never turns it on.
- **Approval:** waiting people see "Your account is waiting for approval. We'll email you when it's ready." (without email: "Ask {contact} to approve it."); admins approve in `/admin/people` → Waiting.
-- **Invites:** by email (with mail) or as copyable links ("Expires in 72 hours"); single use; a resend invalidates the old link; a resend within 5 minutes is refused ("You sent an invite in the last 5 minutes. Try again soon."); daily limits per inviter (200; Platform Free 20). Invites bypass the policy except blocked domains.
+- **Invites:** by email (with mail) or as copyable links ("Expires in 72 hours"); single use; a resend invalidates the old link; a resend within 5 minutes is refused ("You sent an invite in the last 5 minutes. Try again soon."); daily limits per inviter (200; Platform Free 20). An invite skips the sign-up policy, except blocked domains.
- **Without email:** invites are links; "Forgot password?" says "Ask {contact} for a reset link."; admins create single-use reset links (60 minutes, shown once, audited, the person's other devices signed out, two-step kept).
### 9.2 Own libraries
@@ -669,7 +669,7 @@ Every person has a personal workspace created at activation. Everything they mak
**E6 · Seats** (acc-36). Full seats (make things, spend) and free view-only accounts. "18 of 25 full seats used". Overflow becomes view-only ("Your account is view-only. Ask for a full seat."), with a request queue. `seats.assign` runs inside `BEGIN IMMEDIATE` on every activation path; `effectiveTeamRole` clamps view-only seats to Viewer ("Editor · view-only seat").
-**Studio threats and answers:** SSO takeover by email (bound domains, issuer and subject, no auto-link to accounts with credentials or privileged roles); SAML parser bugs (pinned libraries, strict options); cross-site ACS (one exact pattern, RelayState cookie); a rogue connection (owner-only, test before enforce, audit, Inbox); SCIM token theft (scope to SCIM-provisioned people, brake); two-step bypass via OAuth (restricted session); approval splitting (limits stay the hard cap); queue starvation (weights, slot rule, caps); shared ComfyUI exposure (pins, token warning, history cleanup, random prefixes); inspection abuse (view-as off by default, reason, notice, audit); retention mistakes (preview, 7-day notice, Trash, legal hold).
+**Studio protections:** SSO: bound domains, issuer and subject, no auto-link to accounts with credentials or privileged roles; SAML: pinned libraries, strict options; ACS: one exact pattern, a RelayState cookie; connections: owner-only, test before enforce, audit, Inbox; SCIM tokens: scoped to SCIM-provisioned people, a brake; two-step with OAuth: a restricted session; approvals: limits stay the hard cap; the queue: weights, the slot rule, caps; a shared ComfyUI: pins, a token warning, history cleanup, random prefixes; inspection: view-as off by default, a reason, a notice, audit; retention: a preview, a 7-day notice, Trash, legal hold.
## 10. Mode 3: Platform
**Who it's for.** An operator selling a creative-AI service to the public, with staff (owner, admin, billing, moderator, support) and customers on Free, paid and team plans. Platform reuses the core and the Studio pieces that are mode-neutral (fair queue, GPU pool, audit viewer, data lifecycle, view-as, Inbox, two-step).
@@ -681,7 +681,7 @@ Every person has a personal workspace created at activation. Everything they mak
### 10.1 Sign-up and abuse
- **Open by default** (the owner's answer), with: email verification before any free credits; Cloudflare Turnstile through Better Auth's `captcha` plugin on `/sign-up/email`, `/sign-in/email` and `/request-password-reset` (server-side `siteverify`, tokens single-use and 300 s, hostname and action checked; fails closed after a 10 s timeout); disposable domains blocked; emails normalised before checking free-grant uniqueness (lower case, Gmail dots and `+tags`); the `haveibeenpwned` check ("That password has appeared in a data breach. Choose another one."), with an offline top-N list as the fallback when the API is unreachable.
-- **Free-credit farming:** one free grant per normalised email; at most 2 grants per device per 30 days and 5 per network per 24 hours, where a network is an IPv4 /24 or an IPv6 /64 (Better Auth had an IPv6 rate-limit bypass, GHSA-p6v2-xcpg-h6xw); a velocity cap of 5,000 credits a day for accounts younger than 72 hours; free runs on the Free pool and cheaper models; per-IP rules only when a trusted proxy is detected (otherwise they are off rather than install-wide, §7.2), and Platform can't open to the public without one.
+- **Free-credit farming:** one free grant per normalised email; at most 2 grants per device per 30 days and 5 per network per 24 hours, where a network is an IPv4 /24 or an IPv6 /64; a velocity cap of 5,000 credits a day for accounts younger than 72 hours; free runs on the Free pool and cheaper models; per-IP rules only when a trusted proxy is detected (otherwise they are off rather than install-wide, §7.2), and Platform can't open to the public without one.
- **Signals without consent banners** (review 3): the default signals are server-side (IP, card fingerprint, verified email). A device cookie is an option that is consent-gated for visitors from the EU and UK (ePrivacy 2002/58/EC Art. 5(3)); the privacy template states the legal basis for counsel to review.
- **Card testing:** Stripe Checkout only (Stripe's own limiters and Radar); a signed-in account is required to start Checkout; at most 5 Checkout sessions an hour per account and 20 per network; never retry cards from accounts frozen for fraud.
- **Trials and $0 invoices** (a 100%-off first invoice) grant a trial allowance or nothing, never a full plan allowance; promotion codes are limited to first-time transactions and one per card fingerprint.
@@ -954,7 +954,7 @@ All must-fixes are applied. Should-fixes are applied unless the last column says
| Hold sizes for Claude and cold GPU stats | Defined | 7.12 / acc-8 |
| `after()` contradiction | Kept with explicit `runAs` in every package of this plan; with worker roles it runs in the receiving web process | 7.11 |
| Owner loses team content in Personal | Owner keeps team spaces | 7.9 / acc-15 |
-| Full archive bypasses privacy | Reason, audit, admin notice in Studio and Platform | 8 / acc-21 |
+| Full archive and privacy | Reason, audit, admin notice in Studio and Platform | 8 / acc-21 |
| Thin briefs (SCIM mapping, Stripe events, partition rule, `dispatch_state` timing) | Written; holds on live rows never expire, so no package depends on `dispatch_state` for expiry | 9.5 E3, 10.4, 10.10, 7.12 |
| Pins break the 14-day rule | Rule re-checked; table of what it gives today | 5.2 |
| Two OIDC mechanisms | `genericOAuth` for buttons; company IdPs only through E2 | 7.1 |
@@ -1041,7 +1041,7 @@ All must-fixes are applied. Should-fixes are applied unless the last column says
- **Converting about 40 modules and 192 routes.** The sweeps make forgetting fail CI, but the IDOR fixtures must keep pace with new routes and tool paths.
- **Estimates drive limits in Personal and Studio.** `cost_usd` is the list price, not the provider's bill; the copy says "≈" and "Amounts are estimates from each model's list price, not your provider's bill."
- **Guessed money defaults:** the $25 member limit, the 50% markup, plan prices and credits, pack prices, the $2.16 GPU hour.
-- **SAML's history** (ruby-saml, samlify, node-saml and xml-crypto bypasses) and `defaultSSO` being documented for testing in Better Auth.
+- **SAML libraries** stay pinned, and `defaultSSO`, which Better Auth documents for testing, is used only in tests.
- **Unencrypted backup archives** and plain install keys in Personal.
- **Operator legal exposure** in Platform (CSAM reporting, TAKE IT DOWN, DSA, AI Act, GDPR, tax). The templates are not legal advice.
- **Classifier error rates** (ShieldGemma 2's numbers are from an internal benchmark; Llama Guard is text-first) and processor eligibility for face and likeness tools.
@@ -1147,7 +1147,7 @@ _Effort: large. Depends on: none._
- **Sections:** §7.1, §7.2 (password format), §7.9 (fresh installs), §7.15 (secret fingerprint), §7.16, §5.2 (version rule).
- **Files:** package.json (better-auth exact, per §5.2 rule); new src/server/identity/{auth.ts, password.ts, principal.ts, bootstrap.ts, admin-ops.ts, refusals.ts}; src/server/mode.ts (features registry); src/server/backup/snapshot.ts; scripts/auth-schema.mjs; src/server/db.ts (migration 23 identity tables, 24 frozen Better Auth SQL); src/app/api/identity/[...all]/route.ts; shims src/app/api/auth/{login,logout,password,tokens}/route.ts; src/proxy.ts; src/instrumentation.ts (awaited bootstrap); next.config.ts headers().
-- **Behaviour:** Better Auth configured exactly as §7.1: own better-sqlite3 connection, auth_* table names, HKDF secret from FUOBE_SECRET or data/secret.key, __Host- cookies on https via useSecureCookies:false plus per-cookie names, ipAddressHeaders x-fuobe-client-ip written by the proxy only when a trusted proxy is configured, disableIpTracking otherwise, cookieCache off, telemetry off. The router-only endpoint allowlist excludes /sign-up/*, /sign-in/social and /sign-in/oauth2/*; user.create.before refuses any create other than claim-owner and the bootstrap import unless accounts.multi_user=1 (not set by this package). Bootstrap: wal_checkpoint and a pre-accounts snapshot with session rows stripped; root secret and identity.secret_check (refuse to start on mismatch unless FUOBE_ACCEPT_NEW_SECRET=1); import the auth.json password as u_owner's (legacy salt:hash verifies, upgraded to scrypt$v2 N=2^15 r=8 p=3 on sign-in) and tokens as legacy Full tokens; sync FUOBE_PASSWORD every boot. A fresh data dir boots as personal, sign-in off, setup.state=done; a password install becomes Personal with sign-in. The proxy resolves bearer tokens from api_tokens and the Better Auth cookie, keeps DNS-rebinding, crossSite and share logic, and gains OPEN and CROSS_SITE_EXEMPT registries. The login shim signs u_owner in with one password field and answers with a full reload. Security headers: X-Frame-Options DENY and frame-ancestors 'none' except /s/:path*, no-store on auth pages.
+- **Behaviour:** Better Auth configured exactly as §7.1: own better-sqlite3 connection, auth_* table names, HKDF secret from FUOBE_SECRET or data/secret.key, __Host- cookies on https via useSecureCookies:false plus per-cookie names, ipAddressHeaders x-fuobe-client-ip written by the proxy only when a trusted proxy is configured, disableIpTracking otherwise, cookieCache off, telemetry off. The router-only endpoint allowlist excludes /sign-up/*, /sign-in/social and /sign-in/oauth2/*; user.create.before refuses any create other than claim-owner and the bootstrap import unless accounts.multi_user=1 (not set by this package). Bootstrap: wal_checkpoint and a pre-accounts snapshot with session rows stripped; root secret and identity.secret_check (refuse to start on mismatch unless FUOBE_ACCEPT_NEW_SECRET=1); import the auth.json password as u_owner's (legacy salt:hash verifies, upgraded to scrypt$v2 N=2^15 r=8 p=3 on sign-in) and tokens as legacy Full tokens; sync FUOBE_PASSWORD every boot. A fresh data dir boots as personal, sign-in off, setup.state=done; a password install becomes Personal with sign-in. The proxy resolves bearer tokens from api_tokens and the Better Auth cookie, keeps the host allowlist, crossSite and share logic, and gains OPEN and CROSS_SITE_EXEMPT registries. The login shim signs u_owner in with one password field and answers with a full reload. Security headers: X-Frame-Options DENY and frame-ancestors 'none' except /s/:path*, no-store on auth pages.
- **Tests:** identity-bootstrap matrix (no password, password, FUOBE_PASSWORD, tokens, fresh dir); schema guard (getMigrations finds nothing to create or add); allowlist (router-only; auth.api passes; POST /api/identity/sign-up/email answers 403 and creates no auth_user row); password formats and upgrade; proxy matrix (Just me, password install, bearer, cookie, share link); security headers; snapshot has no auth_session rows; fingerprint mismatch refuses start; admin-ops reachability pin; Better Auth behaviour pins (cookie names and attributes on http and https, disableIpTracking skips IP rules, request scope inside hooks, returnHeaders); 50 sign-ins during runner writes with busy waits under 1 s.
- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every existing Vitest suite (FUOBE_MODE=personal default); the eval harness; the only visible change is one re-sign-in on password installs.