# ZitPlane P04 — Account Portal Source Evidence Date: 2026-11-22 Approved baseline: `4404849fc4bd30c7b4b7cabe7caed54cbd7cd37d` Scope: `users/ui/**` + narrow `README.md` and `docs/**`; **P02/P03 source READ-ONLY**. ## Implemented - Separate Next.js `16.4.3` / React `19.2.6` App Router source, Auth.js `next-auth@5.0.0-beta.32` for ZITADEL. - OIDC Authorization Code + PKCE, state and nonce checks, dedicated confidential web client, app-specific JWT session (max 1h). - Validated runtime-only issuer, app origin, client credentials and session secret; production requires HTTPS. - No mock production user, browser-stored token, unsafe callback URL, reused privileged admin PAT or server master key. - Server-side protected layout plus per-page and read-only API identity guards. **User ID is an immutable OIDC `sub`**, never email; token expiry cleared when absent/expired. - Public `/signin`, protected overview/profile/security, and `GET /api/account/me` with user-only response / 401 and no-store. - Local-only sign-out, explicitly **not a global SSO logout**. - Responsive foundation UI, CSS media-query dark mode, no UI dependency on the unmodified Login V2 build. - Read-only profile and links to existing ZITADEL self-service only. Editing profile/MFA, billing, subscription and cross-app admin remain out-of-scope. ## Intentional omissions / acceptance gates The user explicitly excluded all **local builds, tests, dev servers and deployments**, and requested CI in a later phase. As a result, the following are **NOT VERIFIED**: 1. npm dependency compatibility and reproducible lockfile (no lockfile generated or installed in P04). 2. TypeScript typechecking, Next.js production build, React rendering and Auth.js provider behavior. 3. Real ZITADEL OIDC login, callback, session expiry, safe logout and user-scoped API 401/200 behavior. 4. HTTPS proxy/host forwarding, WebAuthn/SSO, account self-service permissions, Docker/Coolify integration. Auth.js v5 is still beta in the pinned version, so CI should validate compatibility and consider a stable alternative before production approval. The beta.32 version includes a patch for advisory GHSA-8fpg-xm3f-6cx3; user identity guards use `session.user.id` rather than merely `!!session`. **P04 source-only audit (2026-11-22):** 28 staged approved files (23 under `users/ui/**`, 5 approved README/docs paths), P02/P03 changes **0**, staged secret files **0**, `git diff --cached --check` **PASS**. Existing unrelated untracked `AI_INSTRUCTIONS.md` was left untouched. This audit verifies repository scope and basic patch hygiene, **not** authentication behavior or build correctness. **No Gitea Actions workflow is created or run in P04.** Source-only Git scope inspection is permitted and does not constitute tests/build. Do not declare runtime acceptance until focused disposable CI and staging checks pass. ## Next steps - P05: approve integration scope and CI foundation, including lockfile generation, version/security review and disposable ZITADEL OIDC configuration; no live deployment. - P06: compact branded UI redesign limited to page/components/styles while preserving authentication contract. - P07: hardened deployment with configured public domains, TLS, persistent secrets and backups after acceptance. References: - https://zitadel.com/docs/sdk-examples/nextjs - https://authjs.dev/getting-started/installation?framework=Next.js - https://authjs.dev/getting-started/session-management/protecting - https://github.com/nextauthjs/next-auth/security/advisories/GHSA-8fpg-xm3f-6cx3