Workflow-App/Workflow/app
sjcoetzeesj-coder b3eaeb7287 feat(auth): password gate replacing the IP-only middleware guard
middleware.ts previously 404'd every external request, which meant the
app was unusable once hosted. There are no per-user accounts, so this
adds a single-password gate:

- /login page + POST /api/auth/login, POST /api/auth/logout
- lib/auth.ts: HMAC-SHA256 signed session cookie (lib/auth), Web Crypto
  only so the same code runs in Edge middleware and Node handlers
- middleware now admits: the signing flow (unchanged, still public),
  /login + /api/auth/*, local requests, and valid sessions. Everything
  else redirects to /login (pages) or returns 401 JSON (API calls).
- password compared with a constant-time compare, wrong attempts
  delayed 600ms to slow online guessing
- cookie is HttpOnly + SameSite=Lax, 12h, Secure when x-forwarded-proto
  says https (Coolify serves the proxy on http today)

APP_PASSWORD / AUTH_SECRET added to .env.example, with a warning: an
unquoted # in an env value starts a comment, which silently truncated
the first generated password and made login fail.

Verified against a real built server: anon->307 /login, anon API->401,
wrong password->401, correct password->200+cookie, signed-in request
reaches PocketBase, /resign/ still 200 without a cookie, forged
cookie->401.
2026-10-18 18:39:27 +02:00
..
(public) feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
(public-register) feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
api feat(auth): password gate replacing the IP-only middleware guard 2026-10-18 18:39:27 +02:00
bizportal feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
bizportal-2 feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
cipc fix: resolve all 7 type errors that broke the production build 2026-10-18 15:48:50 +02:00
cipc-2 fix: resolve all 7 type errors that broke the production build 2026-10-18 15:48:50 +02:00
companies feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
compliance feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
directors feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
groups feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
login feat(auth): password gate replacing the IP-only middleware guard 2026-10-18 18:39:27 +02:00
notes fix(notes): sort by -id instead of -created (PB 400 on fresh collection sort=created) 2026-09-17 13:19:15 +02:00
onboarding feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
registrations feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
resign/[token] feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
resolutions feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
resolve-sign/[token] feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
sars-registrations feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
sars-returns feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
sign/[token] feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
step2/[id] feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
tasks feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
voice-demo feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
error.tsx feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
global-error.tsx feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
globals.css feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
icon.png feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
layout.tsx feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
not-found.tsx feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
page.tsx feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00
providers.tsx feat: commit Workflow app source; move CIPC credentials to env 2026-10-18 15:21:45 +02:00