Harden sign-in: __Host- session cookie and a per-email login lock

- The session cookie is __Host-ngu_session when Secure (production),
  so a sibling subdomain can't set or overwrite it; plain ngu_session
  over local http. Every admin signs in again once after deploying.
- Five wrong passwords for one email lock that email for 15 minutes,
  from any address; a correct password clears it. On top of the
  per-IP limit.
- CLAUDE.md: noImplicitAny stays off on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-29 02:11:57 -05:00
parent d1a6332a45
commit b165e612c2
5 changed files with 83 additions and 5 deletions

View file

@ -15,7 +15,7 @@ Website for NGU (Next Generation of Unity), a Unity movement organization with r
Frontend (repo root):
- `pnpm dev` / `pnpm build` / `pnpm preview`: Vite
- `pnpm format`: oxfmt
- `pnpm exec tsc`: type-check (`noEmit`; there is no separate lint or typecheck script)
- `pnpm exec tsc`: type-check (`noEmit`; there is no separate lint or typecheck script). `noImplicitAny` is off on purpose: turning it on shows about 480 errors (untyped props and params, mostly in OrgList-Map, admin fields, EntityEdit, EventList-Cards). Decided 2026-09-29 not to fix them; don't turn it on or start typing files for it unless asked. New code should still type its props.
- There is no test suite.
Backend (`server/`, Node >= 22.13). The server reads `HOST` (default `127.0.0.1`), `PORT` (default `3001`), `DB_PATH` (default `./ngu.db`) and `UPLOADS_DIR` (default `./uploads`); locally, use `DB_PATH=./dev.db`: