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

6.6 KiB

P05-OIDC-06 — Imported Login V2 Disposable Image & Runtime Acceptance

Date: 2026-11-23 (Asia/Dhaka) Approved baseline: e801318f0126e433f71a3b1f8bb4c6f83aec6611 Prior accepted source: 670e225db477f180ff14ffa62e6654860a166f17 — Gitea Run #96 / Job #210, official prebuilt Login V2 real browser OIDC SUCCESS and owned cleanup SUCCESS. Imported source verification: Gitea Run #89, frozen pnpm / standalone Login build, 1,219/1,219 upstream units and then-current zero Moderate/High/Critical dependency report PASS. Build source alone is not runtime image acceptance.

Pre-source-change exact Scope Lock

This Scope Lock note MUST be committed before implementing the CI-only image/runtime integration.

  • SOURCE WRITE only: new .gitea/workflows/p05-custom-login-acceptance.yml; new deployment/docker/compose.login-ci.override.yaml; new focused tests/ci/login_image/** (build/cleanup/helpers and mandatory new-folder README/MINIFEST); tests/ci/oidc_e2e/run.sh only if a minimal, backwards-compatible opt-in Compose override is necessary.
  • DOCUMENTATION WRITE: notes/**; relevant project/**, docs/**; associated .gitea/workflows and tests/ci README/MINIFEST documentation, root README if necessary. No other first-party or upstream writes.
  • STRICT READ-ONLY: auth/ui/v2/** including upstream Dockerfile, original Login source and package/lock; users/ui/**, core/**, deployment/docker/compose.backend.dev.yaml; all existing workflows; all existing OIDC browser/provision/cleanup/forwarder files other than the optional narrow run.sh hook; package manifests/locks; runner, production/infra/secrets and unrelated files.
  • Preserve untracked root AI_INSTRUCTIONS.md untouched. No local builds/tests, live users, production, public ports, branding, registry pushes, tags or releases. Exactly one separately approved disposable Gitea CI run; no rerun or repeated CI loops.

Focused read-only findings before modifications

  • The imported auth/ui/v2/apps/login/package.json build script makes .next/standalone using Next/Nx and copies public/entrypoint/healthcheck/loader into the standalone output; the untouched upstream auth/ui/v2/apps/login/Dockerfile expects Docker build-context-relative .next/standalone, uses node:24-alpine, an unprivileged default user and /app/entrypoint.sh. Its next.config.mjs compiles basePath from NEXT_PUBLIC_BASE_PATH; CI builder must set /ui/v2/login at build time to match reverse proxy routing.
  • Existing deployment/docker/compose.backend.dev.yaml uses the official prebuilt ghcr.io/zitadel/zitadel-login:v4.20.4, bootstrap token file and dev-only localhost HTTP, and its zitadel-login labels/proxy/healthcheck are the accepted baseline. New override may replace only the image of this service, preserving network, health, labels, secrets and routing. tests/ci/compose.portless.override.yaml clears inherited proxy host port.
  • Existing tests/ci/oidc_e2e/run.sh enumerates exactly four services, has an internal dc() composed from base + portless + IAM_OWNER override, validates Docker resource ownership, creates ephemeral client/human, reuses the original Chromium browser.cjs, and marks owned resources. tests/ci/oidc_e2e/cleanup.sh and tests/ci/backend_cleanup.sh remove run-owned containers, secrets, volumes and Compose network. They MUST remain unchanged. A validated opt-in fourth Compose file and image ID provenance check in run.sh is the minimal necessary exception.
  • Existing manual Gitea workflows use ubuntu-latest Docker-capable runner, container checkout, CLI+Compose; imported Login CI build used Node 22/bookworm, corepack prepare pnpm@10.30.3, pnpm install --frozen-lockfile, pnpm exec nx run @zitadel/login:build --skip-nx-cache. Browser E2E uses a fresh runner namespace and default official image; preserve its default behavior exactly when opt-in is absent.
  • Docker builds run only in CI: use isolated run-labeled Node 22/bookworm builder container, docker cp a fresh checkout workspace into that container; keep all Next/Nx generated files outside the Git checkout, copy only standalone artifacts plus the original untouched Dockerfile to a temporary run-owned Docker build context, build local zitplane-login-ci:$GITHUB_RUN_ID and verify image ID/labels. No registry push or real environment. Do not print credential/PAT files, browser URLs, logs or secrets.
  • The current Dockerfile pins its base by tag (node:24-alpine), not by digest. Record immutable built image ID in CI; a later production supply-chain release must address digest-pinned base, SBOM/signing and current vulnerability audit. Do not modify the upstream Dockerfile under this scope.

Locked implementation and one-run acceptance

  1. Create this note before all source edits, then add a new manual-only Gitea workflow with exactly one job: fresh checkout; ephemeral imported source frozen build in run-labeled Node/bookworm builder; temporary local image build using the untouched Dockerfile; original OIDC run.sh with opt-in image override; mandatory always() two-part cleanup (existing OIDC resources plus new run-owned builder/image/context). A build failure must not leave resources behind or claim source acceptance.
  2. New CI Compose override changes only zitadel-login.image plus safe pull_policy: never; no host ports, custom browser logic or auth bypass. run.sh only accepts a hardcoded opt-in ZITPLANE_OIDC_CUSTOM_LOGIN_CI=1 and exact run-derived local image; validates image ID/digest, verifies Compose selected it, and after startup checks running login container image ID equals the constructed image ID. When disabled, byte-for-byte identical execution behavior remains outside necessary helper declaration.
  3. Focused source/security/diff audit once, commit source then Gitea main SHA verification; dispatch one authorized CI run with tested SHA. Verify original imported Login build, temporary image, actual service container image, health/private Host/issuer, real disposable project/client/human + Chromium original Login V2 OIDC/PKCE/state/nonce/Auth.js callback/session/protected Account page+API/negative/logout, mandatory old+new owned cleanup. No image registry release.
  4. Record exact PASS/FAIL/NOT EXECUTED of every gate, including image-builder cleanup. No scope expansion or retry if blocked; docs synchronization, docs-only commit, final remote HEAD and exact diff verification; distinguish source-tested SHA from docs SHA.

Initial outcome: NOT EXECUTED. Production HTTPS/MFA/passkey/Console/two-app SSO remain out of scope, regardless of this disposable image result.