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

25 KiB
Raw Blame History

P05-OIDC-09 — Production Release Preflight & Source-Verified Deployment Scope

Date: 2026-11-23, Asia/Dhaka. Approved baseline: d3ee3fa4de62463c53d5213c532d097278f928c6; verified exact Gitea main before any file write. Initial tracked files: 791, no truncated tree. Preserve untracked AI_INSTRUCTIONS.md; never read or modify it.

Previously accepted separate evidence: Run #105 / Job #221 COMPLETED SUCCESS on source daaa8b259a519ae0290ba28936ef2279b3a9172c — 48/48 negative fixtures and positive non-deployable synthetic configuration checks PASS, manual-only workflow safety and runner task cleanup PASS. Run #99 SUCCESS on imported custom Login V2 and disposable localhost real-browser OIDC. Neither proves production HTTPS, real credentials or deployment.

USER-APPROVED EXACT SCOPE LOCK — commit this note FIRST

PHASE KIND: DOCUMENTATION-ONLY, READ-ONLY FORENSIC AUDIT. This notes/P05-OIDC-09.md is the FIRST write and must be committed before any other documentation edits.

WRITE ALLOWLIST: notes/**; relevant project/**; relevant docs/**; necessary existing associated README.md/MINIFEST.md for navigation/metadata (root README allowed if necessary). No code, config or workflow writes.

STRICT READ-ONLY: all auth/**, users/**, core/**, deployment/** (including dev and synthetic Compose/JSON), tests/**, .gitea/workflows/**, package manifests and lockfiles, Gitea runner configuration, VPS, DNS, Cloudflare, Coolify, SSL, production infrastructure/secrets, unrelated files. AI_INSTRUCTIONS.md untracked and untouchable. No plugin/connector actions modifying external production resources.

NO EXECUTION: no CI dispatch/rerun, local app build/test, Docker service startup, image pull/build/publish, DNS/TLS requests, live credentials/users/client provisioning, production rollout, release/tag, cleanup of existing resources or change to existing deployments.

Read-only audit target

Inspect approved current repository source and previously recorded CI evidence for production image provenance (pinned builds, SBOM/signatures/security/rollback), canonical issuer https://auth.vib.tools and separate relying-party https://account.vib.tools exact callback, edge trusted Host/forwarded header/h2c, private ports, vaulted secret custody and IAM_OWNER break-glass, encrypted PostgreSQL backup/restore/rollback, Admin Console/first-admin access, MFA/passkeys, Auth.js/real login/multi-app SSO, monitoring/operational incident response. Distinguish SOURCE VERIFIED, CI VERIFIED, LIVE NOT VERIFIED, BLOCKED, OUT OF SCOPE per evidence, not assumptions. Design proposals must be marked proposed, not live.

Prepare a conservative release blocker/stop-condition matrix, dependency sequence and independently approvable small implementation Scope Locks. No mixing image publishing, secret custody, infrastructure, live TLS and SSO in one phase. Explicitly protect existing prod data, no destructive recovery without separate authorization.

Completion contract

After read-only source audit, create docs/P05-OIDC-09.md with source-grounded operator release preflight; expand this note with factual findings, exact file references, accepted CI refs, an ordered plan and a ready-to-copy next approval. Synchronize pertinent existing notes/project/docs documentation and associated README/MINIFEST; reconcile exact Git-tracked inventory (expected 793 only if exactly these two new notes/docs files). Perform ONE focused cumulative baseline-to-HEAD documentation/security/scope audit, ensure zero protected file changes and no credential exposure, commit all documentation to Gitea main and verify final main SHA. CI source SHA and final docs SHA must remain separate. If any evidence is missing, record UNKNOWN/BLOCKED without guessing.

P05-OIDC-09 completed read-only forensic audit — source, acceptance and production boundaries

Audit date: 2026-11-23. Pre-other-docs Scope Lock commit: e30b288fc19922e92b64f538af4c00a910654212. Baseline d3ee3fa4de62463c53d5213c532d097278f928c6 had 791 tracked files, no truncated tree. This phase examined read-only tracked source/documents, existing Gitea Run #105/job #221 and Run #99; did not inspect or modify live servers/DNS/TLS/secrets, perform local tests, start containers or dispatch any CI.

Evidence classification policy

SOURCE VERIFIED = exact files/behavior configured or present in this repository, not demonstrated running in production. CI VERIFIED = actual historical Gitea jobs successfully ran their own explicitly described disposable checks, not public production. LIVE NOT VERIFIED = current public/production evidence unavailable, NOT a claim that the external service does not exist. BLOCKED = mandatory release safety/control not implemented or not accepted by relevant evidence. OUT OF SCOPE = deliberately not modified/tested in this documentation-only phase.

Exact read-only source evidence

  • deployment/docker/compose.backend.dev.yaml: official Go ZITADEL image ghcr.io/zitadel/zitadel:v4.20.4 (version tag, not pinned OCI digest) and postgres:17.10-alpine, Traefik v3.7.7; dev ZITADEL_EXTERNALDOMAIN=localhost, ZITADEL_EXTERNALSECURE=false, ZITADEL_TLS_ENABLED=false, direct --masterkey argument and developer bootstrap first admin, test PAT/temporary local volumes. core/backend/zitadel/dev.py is local-only. This developer Compose must never be promoted to live production unchanged. Go ZITADEL source is not vendored in core/**; it is an external official image.
  • deployment/production-contract/{compose.ci.yaml,routing-policy.json} and .gitea/workflows/p05-production-contract-dry-run.yml: intentionally NON-DEPLOYABLE synthetic.invalid image refs, five zero replicas, private-only network, unresolved symbolic external placeholders, exact proposed issuer/callback/Host+Forwarded/h2c trust policy. Manual config only, no application service lifecycle. Run #105 / job #221 COMPLETED SUCCESS, source daaa8b259a519ae0290ba28936ef2279b3a9172c, 48/48 malformed in-memory cases PASS, Gitea task cleanup PASS. It does not prove a real reverse-proxy configuration, cert or deployed app.
  • auth/ui/v2/apps/login/{Dockerfile,package.json,src/**} and auth/ui/v2/{package.json,pnpm-lock.yaml,pnpm-workspace.yaml}: imported official Login V2 source v4.20.4 (upstream revision documented 384bb9ec96b501ad39dc232ee2061a40fe180bbd); original Dockerfile uses FROM node:24-alpine as a mutable tag, while disposable CI builder tests/ci/login_image/build.sh uses node:22-bookworm and pinned PNPM 10.30.3 via Corepack. The nested Login package's own packageManager declaration differs (PNPM 10.28.2); reconcile and document exact deliberate builder/runner/toolchain provenance in future approval. Original entrypoint tracked mode 100644 required temporary copied-context 0755 fix, not vendor file modification. Run #99 confirmed a real source-built temporary image + Chromium/PKCE/state/nonce/Auth.js session and cleanup in disposable localhost CI. That image was removed: no signed, pinned, registry-published deployment artifact accepted.
  • users/ui/{package.json,package-lock.json,next.config.ts,src/auth.ts,src/lib/{env,identity}.ts,src/app/**}: Account is separate Next.js/Auth.js 5 confidential OIDC relying party; output:"standalone", next@16.4.6, next-auth@5.0.0-beta.32, checked-in npm lockfile present, source HTTPS-origin validation when NODE_ENV=production, AUTH_SECRET minimum length 32 characters, PKCE/state/nonce and provider subject/token-expiry fail-closed session. Protected page/API gate and portal-local logout are in source; automatic access-token refresh, cross-app/global logout and portal-native factor management are NOT implemented. users/ui/src/lib/identity.ts constructs an IdP self-service link, not administrative control. No tracked Account Dockerfile/production packaged OCI image/release workflow, no actual public cookie/Host trust or registered production callback acceptance. Some older docs say lockfile absent/build pending — historical/stale after P05-SEC/P05-CI; do NOT repeat that as current fact. Earlier accepted Gitea Account frozen npm build/audit and isolated Account real OIDC are historical CI, not a production image.
  • .gitea/workflows/p05-security-acceptance.yml, project/DEPENDENCY-SECURITY.md: Run #89 accepted pinned Login PNPM frozen install/build, upstream Vitest 1219/1219 and then-current zero Moderate/High/Critical production advisory results; earlier Run #87 accepted Account npm frozen build and audit. These are dated scans (Nov 22–23, 2026), not future release-time SCA/SBOM/signature evidence. No signed multi-image provenance pipeline or production-release workflow appears under the six checked-in Gitea workflow YAMLs.
  • notes/P05-OIDC-07.md, docs/P05-OIDC-07.md: https://auth.vib.tools proposed single external issuer/TLS443, private Login V2 /ui/v2/login/** port3000 and ZITADEL Go API/Console port8080 h2c with gRPC-Web; separate https://account.vib.tools and exact confidential callback https://account.vib.tools/api/auth/callback/zitadel. Edge must reject unknown Host, strip/replace untrusted Forwarded/X-Forwarded-*, avoid IPv4/IPv6 publicly published API/Login/PG ports, and verify actually issued Secure/HttpOnly/SameSite/host-only cookies and signed-out behavior. No active production DNS/TLS/ingress read or change.
  • notes/P05-OIDC-07.md key and recovery design: exact 32-byte ZITADEL master-key managed separately from encrypted PostgreSQL backup, limited IAM_LOGIN_CLIENT PAT distinct from offline audited IAM_OWNER break-glass; Login session-cookie secret independent of Account AUTH_SECRET and confidential Web client secret; rotations, private DB, encrypted offsite/PITR/isolated restore and tested RPO/RTO. This is only design, no real vault/secrets, key escrow, backup restore or IAM recovery evidence.
  • Existing deployment/docker/compose.backend.dev.yaml sets instance-wide ZITADEL_DEFAULTINSTANCE_FEATURES_LOGINV2_REQUIRED=true in development. Production activation without verified Admin Console and IAM_OWNER API emergency bypass can cause tenant-wide lockout. Imported Login UI contains factor/passkey screens but no accepted WebAuthn enrollment, SMTP recovery, Console admin E2E, second SaaS client or global SSO logout.

Production preflight matrix — do not interchange evidence levels

Release dimension Repository / Gitea evidence Status Required acceptance before production
Official ZITADEL Go backend & PostgreSQL runtime Dev Compose version-tag refs; backend disposable Run #86 SOURCE VERIFIED + CI VERIFIED (dev only); LIVE NOT VERIFIED Approved version/digest, capacity/migration and nonpublic network, production persistence
Imported custom Login V2 Upstream v4.20.4 imported, standalone build, browser Run #99 PASS SOURCE VERIFIED + CI VERIFIED (disposable); release BLOCKED Reproducible OCI production image, pinned base, SBOM/signature/SCA, safe 0755 entrypoint and immutable digest release
Account Portal/Auth.js Source + tracked npm lock; npm build/security Run #87; disposable browser Run #99 SOURCE VERIFIED + CI VERIFIED (dev); image BLOCKED Production OCI packaging, immutable artifact/SBOM, secure host/cookie callback live E2E
Synthetic issuer/routing/secret policy Run #105 48/48 negative rejects, exact static contract CI VERIFIED (static only) Real edge configuration, public TLS, headers/h2c, actual safe secret mount behavior
Public auth.vib.tools / account.vib.tools Design target only LIVE NOT VERIFIED / deployment BLOCKED DNS ownership/CAA/AAAA where appropriate, valid renewals, real HTTPS discovery/issuer equality, strict callbacks and redirects
Image provenance/dependency release Historical CI frozen builds/audits; no signed registry releases Historical CI VERIFIED; production release BLOCKED Per-image source commit and base digest, up-to-date CVE gate, SBOM/signatures attestation verified at pull/deploy, rollback digest retained
Secrets & human/admin recovery Dev .env/bootstrap and documented separation only SOURCE VERIFIED dev; LIVE NOT VERIFIED / BLOCKED Vaulted stable 32-byte master key/escrow, least-privileged independent service PAT and IAM_OWNER, rotation/revocation/privileged audit, first-admin policy
PostgreSQL encrypted backup, restore and key escrow Dev volume and CI disposable cleanup/persistence; no production restore evidence BLOCKED / LIVE NOT VERIFIED Encrypted offsite backups, independently restored same matching key+DB, operator-defined RPO/RTO, PITR/rollback drill
Admin Console and Login V2 cutover Go/Console + imported Login source, dev forced Login V2 SOURCE VERIFIED; LIVE NOT VERIFIED / BLOCKED Stage canary/per-app cutover and human Console login; emergency IAM_OWNER recovery tested before forcing global Login
MFA/passkeys/SMTP Upstream routes and portal informational links SOURCE VERIFIED (UI routes only); LIVE NOT VERIFIED Policy + origin/RP-ID challenges, enroll/rotate/recover/lost-device, SMTP verification, no lockout
Multiple SaaS OIDC clients/SSO/logout One Account relying party in disposable real OIDC CI VERIFIED single app; multi-app BLOCKED Two independent clients/apps with issuer/audience/redirect/tenant/role isolation, logout/session semantics and negative tests
Operations / monitoring / incident response Only CI runner-owned cleanup, dev healthchecks and design SOURCE VERIFIED dev; LIVE NOT VERIFIED / BLOCKED HTTPS/cert expiry, OIDC/error/DB/backup/secret alerts, health gates, documented rollback/incident ownership, restore alarm drill
This P05-OIDC-09 actions Docs and read-only review only OUT OF SCOPE for runtime changes No new CI, local builds, DNS, secret use or live production action

Release priority, dependencies, operator STOP conditions

  1. P0 supply chain first (offline/disposable): prove reproducible tracked-source Login image and Account image in separate, minimal CI phases; independently verify Go/Postgres/Traefik digest provenance; evaluate current vulnerabilities; only then approve isolated signing and registry publishing (separate permission/scope). Registry artifact acceptance does not allow deployment.
  2. P0 identity and data custody: secure master-key ownership/escrow, Login service vs IAM_OWNER separation, Account client/auth secrets and their rotation; then backup encrypted independent PG data with matching key, isolated restore, restore-failure rollback, RPO/RTO and one-time first-admin recovery. Never migrate real state or rotate master key before restore readiness.
  3. P0 private runtime/operations: nonpublic DB/API/port binding, stable persistent volumes/migrations, health/metrics/alerts and rollbacks. Configure canary/private deployment only under fresh approval, no production traffic or instance-wide LoginV2 toggle.
  4. P0 public HTTPS trust boundary: separately approved real DNS/cert automation + edge policy, exact HTTPS issuer/callback, h2c routing, Host/Forwarded spoof negative tests including IPv6, cookies/HSTS staging. Stop on issuer mismatch, incorrect redirect, missing TLS/renewal or exposed ports.
  5. P0 admin safe cutover: before enabling LoginV2 for all apps, verify two independent privileged recovery paths (real Admin Console plus isolated IAM_OWNER API break-glass), protected PAT, canary/per-app rollback, recover from an intentionally isolated misroute; lockout is a STOP.
  6. P0 controlled real OIDC: after gated real HTTPS infrastructure, verify real Login V2 + Account confidential Web client, PKCE/state/nonce, secure host-only cookies, authenticated API, negative redirect/Host/CSRF/session expiry, local vs federated logout contract, private logs and cleanup. Do not use real identities in CI.
  7. P1 separately: real MFA/passkey/SMTP recovery, then second SaaS app/multi-tenant OIDC/SSO and session/logout, followed by HA/backup/incident drill and separate final release/change approval. Monitoring and backup alerts must be established before opening public traffic, even if deeper HA follows later.

Global STOP/rollback: no production action without explicit separate approval; unverified matched masterkey/DB backup or admin break-glass, mutable/unsigned image, missing secure TLS issuer/Host trust, unregistered callback, uncontrolled exposed ports, failed signed digest/rollback verification, failed restore drill, insecure cookie/secret, unowned resources or user-impacting authentication regression = fail closed. Rollback must preserve DB, master key and existing credentials, pin previous tested image digest and proxy routing, avoid downgrading schema without proven reversible migration, no mass logout, and require audit log + explicit operator approval for any stateful recovery. No live rollback performed here.

Separately approvable narrow phase ladder (PROPOSED ONLY; not authorized)

Each phase requires its own new pre-source Scope Lock note, evidence-first source diff, exact write whitelist, protected unrelated paths, security/rollback gate, one focused verification/one CI maximum where authorized, docs synchronization and final SHA. No silent broad scope creep.

Order Proposed phase Exact candidate write boundary One independent acceptance / exclusions
1 P05-OIDC-10 — CI-only imported Login OCI image provenance & reproducible build gate NEW notes/P05-OIDC-10.md, tests/ci/login_image/provenance.py, tests/ci/login_image/{README.md,MINIFEST.md}, NEW .gitea/workflows/p05-login-provenance.yml; narrowly existing tests/ci/login_image/build.sh only if separately justified by reproduced defect; relevant notes/project/docs, matching manifest/README One disposable Gitea run: imported source SHA + pinned builder/base OCI digest evidence (no unpinned mutable deployment image), frozen PNPM/Next standalone/image, entrypoint 0755, safe SBOM/materials attestations and strict no secrets; cleanup. No registry push, signing keys, release, Account/backend edit, production, tags
2 P05-OIDC-11 — Account Portal OCI image packaging/CI provenance NEW isolated tests/ci/account_image/**, new manual account-image workflow, ONLY if required users/ui/Dockerfile and necessary Account image build config (no Auth.js behavior edit), docs npm ci frozen build using existing lock, secure standalone nonroot OCI, digest+SBOM+anonymous/synthetic auth-negative validation; no publish/deploy
3 P05-OIDC-12 — Official backend DB/Traefik digest and compatibility/SBOM review CI-only new pin/security manifest and dedicated new manual workflow/helper (paths to be set in its own Scope Lock), docs; existing dev Compose read-only Verify official ZITADEL Go/PG/Traefik version→immutable digests and licensing/CVE/upgrade/migration compatibility; no replacement of running images
4 P05-OIDC-13 — Release attestation/signing and nonproduction registry publication New release-only workflow/helper + trust policy docs (exact paths/credentials determined at approval); no app source Verify manifest list/SBOM/signature provenance and digest-pinned pull from private staging registry, rollback digest; new registry-only authorization required, no VPS deployment
5 P05-OIDC-14 — Secure secret custody & IAM_OWNER break-glass contract New narrowly scoped security configuration/provisioning only as separately approved + docs; use disposable placeholders first Vault/escrow, stable 32-byte key, least-privilege distinct Login PAT, Account client/session secrets, rotation and audited emergency recovery; no real secret creation until live approval
6 P05-OIDC-15 — PostgreSQL encrypted recovery and isolated restore acceptance New dedicated backup/restore tooling and CI-only disposable recovery tests; existing dev and synthetic stacks read-only Encrypted backup+matching key escrow and isolated restore/PITR/rollback failure drills, bounded RPO/RTO; no production restore
7 P05-OIDC-16 — Private production runtime, observability and rollback foundation New separately approved production-only non-dev deployment material and monitoring scripts; no dev Compose overwrite Stable private networks, restricted DB, digest-locked images, health/alerts, snapshot/rollback with dry-run; no public ingress or global LoginV2 flip
8 P05-OIDC-17 — Public HTTPS issuer + trusted h2c ingress acceptance New production edge/DNS/TLS files only with explicit hosting/domain approval; secrets separate Real issuer/cert/renewals and exact Host/Forwarded/callback/h2c/IPv4+IPv6 negative verification with zero public backend ports, rollback route
9 P05-OIDC-18 — Admin Console/IAM_OWNER and Login V2 canary cutover Exact auth feature config/cutover & recovery tooling only under explicit production scope Real human Console and separate break-glass recovery before staged LoginV2 enforcement, test rollback on nonprod first
10 P05-OIDC-19 — Real HTTPS Account OIDC, cookies and protected API Exact public OIDC client registration/session runtime config+focused live acceptance workflow; separate approval for test users Real browser PKCE/state/nonce, strict callback/Host/forwarded/cookie/expiry and local logout, no production secrets in CI
11 P05-OIDC-20 — MFA/passkey/SMTP recovery Narrow factor/email/policy tests/config only Verified WebAuthn RP origin, enrollment/recovery/lost device, SMTP sender, scoped account policies and no lockout
12 P05-OIDC-21 — Two independent SaaS OIDC client SSO and logout Dedicated second-client integration/fixtures; no unrelated billing/entitlement changes Multi-app issuer/audience/role/tenant isolation, session and federated logout semantics; real second app acceptance
13 P05-OIDC-22 — Production go/no-go and controlled release Operations/runbook/release metadata only after separate explicit release approval Every P0 gate evidence, fresh vulnerability/security/backup/cert/alerts, no P0 blockers; operator-signed release/rollback window

Phase order may be revisited if preflight finds an objectively blocking dependency; no implied authorization for any phase. Import and Account OCI image source are separate to avoid mixing app/service boundaries. Future scopes need exact file count and branch SHA before implementation.

First exact ready-to-copy approval — P05-OIDC-10 (NOT YET APPROVED)

Baseline: use the final verified P05-OIDC-09 documentation-only main SHA upon closure. Purpose: CI-only imported Login OCI artifact provenance, deterministic build inputs and safe cleanup; no production release or registry publishing. Scope-first notes/P05-OIDC-10.md; exact source writes NEW tests/ci/login_image/provenance.py, existing tests/ci/login_image/{README.md,MINIFEST.md}, NEW .gitea/workflows/p05-login-provenance.yml and only if separately demonstrated/allowed tests/ci/login_image/build.sh (do not modify by default). Associated workflow README/MINIFEST, notes/project/docs/source-inventory, root README if necessary. auth/**, users/**, core/**, deployment/**, other tests/workflows, package locks/manifests, runner, VPS/DNS/SSL/secrets strictly read-only; untracked AI_INSTRUCTIONS.md untouched. No altering old Run #99 or Run #105 workflows. Focus on image source SHA/material provenance, reproducible lock/build, base tag→immutable digest validation, original Dockerfile/user/entrypoint executable gate, safe SBOM metadata, temporary artifacts only and always() exact runner-owned cleanup. One new manual Gitea run only if separately approved, exact positive/negative cases, no rerun on failure, docs commit and exact remote SHA. No registry push, signing private keys, deployed images, real credentials, infrastructure, tag or release.

P05-OIDC-09 terminal production status: preflight mapping completed documentation only. Gitea Run #105 synthetic acceptance and Run #99 isolated real OIDC remain accepted, but production GO/NO-GO = NO-GO/BLOCKED pending P0 gates and separate approvals. No production/DNS/SSL access was attempted.