All documents

MERIDIAN · DOC 18 / 25

Security

Server-side isolation, authN/Z, session security, validation, headers, safe public payloads, socket authorization.

The practical security reference for every phase. Authentication and authorization are IMPLEMENTED (Phase 3); hardening items carry their owning phase. One principle governs everything:

The frontend is not a security boundary. The backend — and only the backend — enforces authorization.


1 · Server-side tenant isolation

2 · Authentication — IMPLEMENTED

3 · Authorization — IMPLEMENTED

Website-configuration authorization (Phase 8)

Tenant-administration security rules (Phase 4)

4 · Password hashing — IMPLEMENTED

5 · Session & cookie security — IMPLEMENTED

ControlState
HttpOnlyalways — JavaScript cannot read the cookie
Secureproduction only (HTTPS); localhost dev on plain http is allowed
SameSiteLax — cross-site POSTs don't carry sessions
Token storagenever localStorage/sessionStorage/URL — no JS-readable tokens exist
Session at restSHA-256 hash — DB leak yields no usable tokens
Logoutdestroys the server-side session, idempotent
Password changerehashes, kills every OTHER session, keeps the current one
Expiry7-day absolute; TTL index cleanup

6 · Input validation — IMPLEMENTED

7 · Transport protections

ControlRule
CORSsame-origin deployment; credentialed cross-origin access is not offered; * is never combined with credentials
CSRFfour layers: SameSite=Lax · Origin allow-list on non-GET · JSON-only bodies · same-origin deployment (docs/authentication.md §9)
Security headersPhase-2 set on every API response (nosniff, DENY framing, referrer/permissions policy, restrictive CSP, no-store)
Secretsenv-only; server-only modules; NEXT_PUBLIC_ = public by definition

8 · Safe API responses & public data (Phase 6)

Sharing & deep-link security (Phase 9)

9 · Account-enumeration & brute-force defenses — IMPLEMENTED

10 · Socket.IO authorization — IMPLEMENTED (Phase 7)

11 · Database is never exposed to the browser

No connection strings in client bundles, no direct DB access from UI code, no Mongoose imports outside src/server / src/db. The browser only ever sees /api/v1 envelopes.

12 · Logging restrictions — enforced

Never logged: passwords, hashes, session tokens, raw cookies, secrets (logger redaction: *.password, *.token, *.secret, auth headers, cookies). Logged: auth event categories, guard rejections, rate-limit hits, connection lifecycle. Full event list: docs/authentication.md §10.