Files
ZitPlane/notes/P05-OIDC-05.md
T

14 KiB

P05-OIDC-05 — Production-Context Integration Readiness Forensic Audit

Date: 2026-11-23 (Asia/Dhaka) Approved baseline: b3841d8c05d6b47ceaf1dbc5f7103b8de4f256e6 Accepted isolated test: Gitea Run #96 / Job #210, source SHA 670e225db477f180ff14ffa62e6654860a166f17; overall SUCCESS and mandatory cleanup SUCCESS. Mode: READ-ONLY source/infrastructure forensic audit; documentation-only Git changes.

Pre-document-change Scope Lock and approach

This note is created/committed before any other P05-OIDC-05 documentation updates.

WRITE ONLY: notes/**, relevant project/**, relevant docs/** and associated README/MINIFEST files if actually required. No code, configuration, CI workflow, application, dependency, runner or deployment writes. Do not invent infrastructure details or a live environment.

STRICT READ-ONLY: tests/**, .gitea/workflows/**, core/**, deployment/**, auth/**, users/**, all package manifests/lockfiles, runners, all production/hosting/configuration/secrets, and unrelated files. Preserve untracked AI_INSTRUCTIONS.md. No local builds, tests, dev servers, CI dispatch/rerun, login to any real user, API mutation, deployment, tag or release.

Focused audit steps:

  1. Verify main HEAD equals the approved baseline; inspect source tree/manifests and independent terminal Gitea Run #96 Job #210 evidence, without generating new CI.
  2. Trace official prebuilt Login V2 container in deployment/docker/compose.backend.dev.yaml, imported upstream auth/ui/v2/** source, build artifacts/runtime image wiring, and admin-console routes.
  3. Trace Account Portal users/ui/** Auth.js/Next.js issuer, PKCE/state/nonce, callback, token subject/session guards, HTTP-vs-HTTPS production validation, cookies, proxy headers, redirect allowlists and logout semantics.
  4. Inspect source-level MFA/passkey readiness, interactive Admin Console verification, multi-client/multi-app SSO, organizations/tenancy and authorization boundaries. Identify absent evidence rather than guessing capabilities.
  5. Trace documented packaging/deployment (Docker/Compose, images, domains, TLS termination, secrets, persistence/backup, rollout/rollback, health/logging/CI/CD) and distinguish experimental localhost from production readiness.
  6. Produce prioritized evidence-based blocker matrix with IMPLEMENTED, VERIFIED, UNVERIFIED, BLOCKED, PROPOSED; name exact path/function or CI job for each material finding. Recommend one next small implementation phase with locked files, security gates and separate approval.
  7. Documentation synchronization only; one focused Markdown/manifest/diff audit, Git commit/push to Gitea main and exact remote SHA verification. No new CI, source tests or simulated production acceptance.

Acceptance conditions: No unauthorized changes; published documentation agrees with source plus Run #96; limitations prominently exclude production HTTPS/MFA/SSO or custom Login integration as verified; final docs SHA and tested CI SHA clearly distinguished.

Initial disposition: Forensic audit PENDING. No claim that production deployment, MFA/passkeys or imported Login V2 is integrated or accepted.

Completed forensic audit — P05-OIDC-05

Status: READ-ONLY SOURCE/EVIDENCE AUDIT COMPLETE on 2026-11-23; application/CI/runner/production paths unchanged. Scope Lock note was committed first as f91e7956f5d42862962b1dfb69eb2f4bbb2b1466. The approved main baseline b3841d8c05d6b47ceaf1dbc5f7103b8de4f256e6 had 759 tracked files. No new CI was dispatched.

Evidence rechecked without execution

  • Gitea Run #96, Job #210, immutable tested source 670e225db477f180ff14ffa62e6654860a166f17: completed SUCCESS, all 4 job steps SUCCESS, original prebuilt Login V2 plus genuine Chromium/password/authorization code/PKCE S256/state/nonce/Auth.js callback/subject/HttpOnly local session/protected page+API/anonymous and tampered-callback negative checks/portal logout PASS. Disposable IAM_OWNER project/client/test human and owned-only credential/DB/container/network cleanup PASS. Pre-bind listener in proxy network namespace: traefik PID 1, TCP6:8080. Run #96 used HTTP localhost/Next.js dev in isolated Gitea, not public TLS production.
  • Run #89: imported Login V2 source frozen PNPM build, standalone artifact, 1,219/1,219 unit tests and zero Moderate/High/Critical production advisory findings at that run PASS. It did not execute that source as the ZITADEL Login service in browser E2E. Run #87: Account build and security jobs succeeded although overall run failed on separate historical Login advisories. No current production audit was rerun.
  • Read-only reviewed tree: deployment/docker/compose.backend.dev.yaml, core/backend/zitadel/README.md, auth/ui/v2/README.md, imported apps/login/Dockerfile and build manifest, src/proxy.ts and service URL/header helpers, users/ui/src/{auth.ts,lib/env.ts,lib/identity.ts}, protected pages/API, Account package/Next config, .gitea/workflows and disposable tests/ci/oidc_e2e. No tracked production Compose/Coolify application definitions or Account production Dockerfile were found; absence in repository does not prove absence of external infrastructure, which was not inspected.

Source and acceptance matrix

Domain IMPLEMENTED in source VERIFIED evidence BLOCKED / UNVERIFIED
ZITADEL/DB/reverse proxy Dev-only Compose with ZITADEL 4.20.4, PostgreSQL 17.10, Traefik 3.7.7 Run #86 persistence/discovery; Run #96 healthy/portless No reviewed separate production Compose, TLS/ops or durable backup
Original official prebuilt Login V2 zitadel-login service points to ghcr.io/zitadel/zitadel-login:v4.20.4 Run #96 real authenticated OIDC PASS No production HTTPS or Admin Console human acceptance
Imported customizable Login V2 Upstream v4.20.4 source, proto/client workspace, upstream Dockerfile Run #89 build/unit/audit PASS Custom-source image not wired to runtime; no real custom-image browser test
Account Portal Next.js/Auth.js OIDC, PKCE/state/nonce, subject/expiry fail-closed, protected API/pages, local logout Run #87 production build; Run #96 real dev-origin session/API/negative/logout PASS No shipped production image, HTTPS-origin browser acceptance, refresh/federated logout
MFA, passkeys, recovery Upstream source contains policy-dependent mfa/otp/passkey/u2f/password/register routes; Account security is informative No dedicated integrated MFA/WebAuthn/recovery acceptance NOT VERIFIED in custom or production runtime
Admin Console / self-service Backend routes and Account link to /ui/console/users/me Account protected pages only; no real Console human test Console privileges/cutover and self-service route/policy UNVERIFIED
Multi-app SSO Architecture target; one Account relying party with stable user subject Run #96 creates one disposable client/Account flow Second app/client, org/tenant scoping, entitlement, cross-app login/logout NOT EXECUTED
Release and operations Dev secrets/volumes and manual Gitea CI Disposable cleanup + historical security/build gates Production image registry/release, DNS, monitoring, key rotation, backup/restore, rollback, SMTP NOT VERIFIED

Prioritized blockers — evidence and necessary future gate

P0-1 — Imported Login V2 not wired at runtime. deployment/docker/compose.backend.dev.yaml starts official prebuilt image even though auth/ui/v2/apps/login has buildable upstream source and an existing Dockerfile. Run #89 accepted its build, not a custom-source runtime image; Run #96 accepted original prebuilt image. A controlled disposable image packaging + real browser acceptance gate is necessary before claiming customized Login V2 runtime.

P0-2 — No verified production HTTPS issuer/proxy/callback. The only Compose sets ZITADEL_EXTERNALDOMAIN=localhost, ZITADEL_EXTERNALPORT=8080, ZITADEL_EXTERNALSECURE=false, ZITADEL_TLS_ENABLED=false and CUSTOM_REQUEST_HEADERS=Host:localhost,X-Forwarded-Proto:http, with a developer 127.0.0.1:8080:80 bind and internal h2c API routes. Proposed hosts auth.vib.tools and account.vib.tools are not verified as live. A dedicated HTTPS ingress must preserve canonical external issuer, exact login path and registered Account callback https://account.vib.tools/api/auth/callback/zitadel; sanitize Host/forwarded headers and verify HTTP/2/h2c, redirects, cookies and failure behavior. The Traefik service mounts the Docker socket as :ro, but a filesystem read-only socket mount does not restrict Docker API privileges; production hardening needs explicit review. Official references: https://zitadel.com/docs/self-hosting/manage/reverseproxy/reverse_proxy and https://zitadel.com/docs/self-hosting/manage/production .

P0-3 — No production secret/DB recovery/runbook evidence. core/backend/zitadel/dev.py and development Compose use an ignored locally generated .env, a development first-instance admin/email shortcut, bootstrap master key and login-client PAT volume with documented 2028 expiration. Do not reuse these accounts, values, volumes or settings for production. No checked-in reviewed secure secret store and rotation, break-glass IAM_OWNER, least-privilege identity/bootstrap workflow, production PostgreSQL backup/restore, SMTP/recovery, monitoring or safe rollback/upgrade mechanism were identified. ZITADEL recommends controlled Login V2 cutover and break-glass access: https://zitadel.com/docs/self-hosting/manage/adopt-login-v2 .

P1-1 — HTTPS/Host/cookie/session gap. users/ui/src/lib/env.ts::validatedUrl requires an HTTPS origin in production and oidcSettings checks nonempty credentials and minimum secret length. These checks do not install TLS or configure an ingress; the code only passes AUTH_TRUST_HOST to Auth.js if explicitly true. Only trust a proxy that scrubs incoming untrusted forwarding headers. users/ui/src/auth.ts has Auth.js JWT, PKCE/state/nonce, 1h maxAge and subject/token expiry fail-closed, no refresh, global IdP logout or token revocation. users/ui/src/components/account-shell.tsx::portalLogout signs out locally. Run #96 verified HttpOnly and authenticated session under disposable HTTP localhost; secure/SameSite cross-domain cookie attributes, production HTTPS and multi-replica secret rotation were NOT EXECUTED. Official Auth.js production reference: https://authjs.dev/getting-started/deployment .

P1-2 — MFA/passkey/Console/self-service not accepted. Imported upstream routes exist but no approved factor-enrollment policy and no genuine WebAuthn RP/domain/OTP/recovery/browser E2E. users/ui/src/app/(protected)/account/security/page.tsx displays descriptive rows and a link, not local factor edits. users/ui/src/lib/identity.ts::zitadelSelfServiceUrl constructs Console self-service URL; permissions/route access not verified. Instance-wide Login V2 cutover may affect Console login; test with disposable break-glass/rollback.

P1-3 — No multi-application SSO acceptance. Only one Account OIDC relying party was provisioned. No second SaaS client with independent redirect, cross-app shared-session, issuer+subject identity binding in each business app, organization/role/tenant/entitlement or global logout isolation was tested. Portal overview statements are architectural goals, not feature-acceptance evidence.

P2 — No production artifact/release/observability gates. Login imported Dockerfile exists and build output verified, but no CI-produced custom Login image runtime test or production registry/pinning/signing; Account has next.config.ts standalone output but no production Docker packaging. No production certificate automation, operational health/alerts, SMTP, disaster restore, rollback or security release audit. Run #89 advisory result is historical, not proof of a current zero-advisory release.

Audit disposition and next exact proposal

P05-OIDC-05: COMPLETE / READ-ONLY. Development-origin original-prebuilt OIDC VERIFIED, production-context readiness BLOCKED / NOT VERIFIED. No source modification, new CI, tests/builds, production access, human accounts, tags/releases or changes to untracked AI_INSTRUCTIONS.md. Documentation-only closure does not produce a new tested source SHA.

Recommend next separately approved phase: P05-OIDC-06 — Imported Login V2 Disposable Image & Runtime Acceptance. Scope Lock:

  • WRITE: create notes/P05-OIDC-06.md first; new .gitea/workflows/p05-custom-login-acceptance.yml; new CI-only deployment/docker/compose.login-ci.override.yaml; new focused tests/ci/login_image/**; optionally, only if necessary, a minimal backwards-compatible opt-in override hook in tests/ci/oidc_e2e/run.sh to reuse accepted real OIDC suite; related notes/**, project/**, docs/** and associated README/MINIFEST.
  • STRICT READ-ONLY: auth/ui/v2/** including upstream Dockerfile/source/package locks, users/ui/**, core/**, existing development Compose, existing workflows, existing browser/provision/cleanup files (except explicitly allowed run.sh hook), package manifests/locks, runners, production/secrets/unrelated files.
  • Purpose: isolated Gitea build of imported workspace → ephemeral local Docker image from existing upstream Dockerfile → CI-only Compose overlay substitutes custom image → one approved real Chromium Login V2/PKCE/Auth.js/session/API/negative/logout + owned cleanup acceptance. No public ports, real users, registry push, local builds/tests, production, branding edit, tags/releases or repeat CI. Stop/report if blocked, no scope expansion.
  • Order after P05-OIDC-06: separate production HTTPS/secret/backup/rollback design and acceptance; then MFA/Admin/SSO gates only after dedicated approval.

No production deployment state was inspected. This report identifies repository-backed evidence gaps, not the state of arbitrary external services.