Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/hook/server/inbox-auth-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe("plannotator inbox auth", () => {
expect(out.join("\n")).toBe("");

expect(await run(["add", ME], ["short", "short"])).toBe(1);
expect(err.join("\n")).toContain("at least 12 characters");
expect(err.join("\n")).toContain("at least 10 characters");

expect(await run(["add", ME], [PASSWORD, PASSWORD])).toBe(0);
expect(out.join("\n")).toContain(`Account ${ME} made`);
Expand Down
2 changes: 1 addition & 1 deletion apps/inbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>Plannotator Inbox</title>
<title>Zosma Inbox</title>
<!-- No type: /favicon.ico is served by the Inbox server, which picks the
bytes from the persisted favicon style (Glass and Yellow are multi-size .ico
files, Face is a PNG), so the response Content-Type is the truthful
Expand Down
2 changes: 1 addition & 1 deletion docs/agent-guides/inbox-notifications-and-agents.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/agent-guides/inbox-sign-in.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Before it reaches the window, `Cf-*`, `Tailscale-*`, `X-Forwarded-*` and `Planno

**What a passkey does not change.** The allowlist is still the gate: a passkey sign-in for an address that is not on `inboxAuth.allow` gets a real session from Better Auth and is then refused by the door (`303 /login?error=account` for a page, `401 account_not_allowed` for a call), exactly as a password sign-in would be. `/mcp`, the connection routes and a launched session's permission hook stay closed to everyone; the door's cookies still stop at the door; adding a passkey needs a session, so nobody can enrol one onto an account they have not already got into.

**Accounts, made here.** There is no self-sign-up (`disableSignUp: true`): accounts are made at the terminal, `plannotator inbox auth add <address>`, with the password asked for twice, not echoed, at least 12 characters (`AUTH_MIN_PASSWORD_LENGTH`), and its address must already be on the allowlist to get in. `auth add` on an existing address sets a new password and ends every session it had (`AUTH_SESSION_SECONDS` is 7 days, renewed at most daily). `auth remove` ends them and deletes the account. The accounts and their sessions live in sqlite in the data folder (`<dataDir>/auth.sqlite`, WAL), and Better Auth's signing secret beside it in `<dataDir>/auth-secret` (0600, 32 random bytes, made once), so a restart keeps sessions; `PLANNOTATOR_AUTH_SECRET` overrides the file, which is what a test uses.
**Accounts, made here.** There is no self-sign-up (`disableSignUp: true`): accounts are made at the terminal, `plannotator inbox auth add <address>`, with the password asked for twice, not echoed, at least 10 characters (`AUTH_MIN_PASSWORD_LENGTH`: the owner's `Firstname@2026`), and its address must already be on the allowlist to get in. `auth add` on an existing address sets a new password and ends every session it had (`AUTH_SESSION_SECONDS` is 7 days, renewed at most daily). `auth remove` ends them and deletes the account. The accounts and their sessions live in sqlite in the data folder (`<dataDir>/auth.sqlite`, WAL), and Better Auth's signing secret beside it in `<dataDir>/auth-secret` (0600, 32 random bytes, made once), so a restart keeps sessions; `PLANNOTATOR_AUTH_SECRET` overrides the file, which is what a test uses.

**The allowlist is the gate, the account is the key.** `inboxAuth.allow` names the addresses that may enter; a signed-in session whose address is not on it is refused (`account_not_allowed`, and the page says so), and `auth list` marks the account as not on the allowlist rather than hiding it. Take an address off the allowlist and it cannot get in, though its account stays for the day it is put back; `auth remove` is the other half.

Expand All @@ -56,7 +56,7 @@ Before it reaches the window, `Cf-*`, `Tailscale-*`, `X-Forwarded-*` and `Planno

**In Settings → Remote devices.** (`packages/inbox/components/WithAnAccount.tsx`, `packages/inbox/data/inboxAuth.ts`, under "Sign in with a Plannotator account".) The card reads the door once when the section mounts — it is opened by nothing else, because it does not change what is on the rest of Settings — and draws one of five things, said the same way on the card, in the CLI and in this guide. No `inboxAuth` in config.json: a line and a **Set up** button; the form that follows asks for the name the door answers at, the addresses that may enter, and the first account's address and password, and makes the account *before* it opens the door, because an open door nobody can enter is a broken Inbox. Then the switch (**Use your account to get in**), the address in the address bar (`https://<host>/login`) with its own **Copy** button, the accounts (never a password), and the list of addresses that may enter, each removable and asked twice (`components/AskTwice.tsx`, the same second click as removing a paired phone). **Use your account to get in** off (config.json `on: false`, listener closed): the address line goes away and the accounts and the list stay, with "Closed. The name still answers, but nobody gets in. Your accounts are kept." — the same words the CLI says. And if the door itself answers that it will not change from where it is being read, the card shows "Only the Inbox's owner changes how you get in. Change this on the computer itself or over your tailnet." and offers nothing to click, rather than buttons that would only fail. Which requests those are is the owner's and nobody else's: anyone who came in through the sign-in door, and anyone who came through Cloudflare Access, are both refused (`refuseDoorOrigin`, and the `fromCfDoor` mark the Cloudflare card already answers with). The first because a person signed in at a door must not change the accounts and the allow list of the door that let them in; the second because Access admits a whole team, and a teammate is not the owner of this Inbox.

Everything the card writes goes to `/api/inbox/sign-in*` (the rows in [`server-and-storage.md`](server-and-storage.md)), which is this computer's or the tailnet owner's, never a paired phone's or a relay's, and never through the door: the card shows its actions while the door's own read says *what* the door is, and writes only from where the door can be written. The password floor is one number in one place, `AUTH_MIN_PASSWORD_LENGTH` (`packages/server/inbox-auth-instance.ts`), which the card shows as it is (`password, 12 characters or more`) instead of saying 8 in one place and checking 12 in another.
Everything the card writes goes to `/api/inbox/sign-in*` (the rows in [`server-and-storage.md`](server-and-storage.md)), which is this computer's or the tailnet owner's, never a paired phone's or a relay's, and never through the door: the card shows its actions while the door's own read says *what* the door is, and writes only from where the door can be written. The password floor is one number in one place, `AUTH_MIN_PASSWORD_LENGTH` (`packages/server/inbox-auth-instance.ts`), which the card shows as it is (`password, 10 characters or more`) instead of saying 8 in one place and checking 10 in another.

**Tests.** `packages/server/inbox-auth-door.test.ts` (the door end to end on a real listener: off by default, the `303` and the `401`, sign in and reach the window, a wrong password, an address off the allowlist, `/mcp` refused, the page's CSP and host, cookie stripping, `safeNextPath`) and `apps/hook/server/inbox-auth-command.test.ts` (the command: config.json, the twice-typed password, the allowlist note, remove, off, `--json`). The settings card: `packages/server/inbox-auth-routes.test.ts` (a real door in a temp `PLANNOTATOR_DATA_DIR`: an Inbox that has never set one up, a first account then an open door, the account made before the door opens, a turn on and off without losing accounts, a list that grows by one, the minimum length, an address that is not on the list, the door's own requests refused, and config.json read back after each) and `packages/inbox/withAnAccountCard.test.tsx` (the card in the DOM test runner: waits for the read, the set-up form's order and its one post at a time, the refused card, remove asked twice, the switch keeping accounts, an added address joining the list, a door it could not read and the retry that reads it again, and a door the environment pins). Passkeys: `packages/server/inbox-auth-passkey.test.ts` (17 tests, a real ceremony through `passkey-fixtures.ts`: register, sign in and reach the window, a replayed assertion, another key, another site, another account, the allowlist, removal, another site's removal refused, the page and the CSP, a pinned port accepting the same key at both addresses, and an unpinned door refusing a port.) The port itself is the named cases above; `packages/server/inbox-auth-routes.test.ts` keeps `httpsPort` through a save that never mentions it and out of config.json when there is none.

Expand Down
Loading
Loading