76 lines
12 KiB
Markdown
76 lines
12 KiB
Markdown
# 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.
|
|
|
|
## Terminal result — one real CI cycle and exact RCA boundary
|
|
|
|
**Scope Lock commit (before code):** `c93468fb6066b532c29ef1625cf0e3964eb1fd9d`. **Tested source commit:** `fcfa59e826c39b445faa1b5b26c47ce715d8c3d6`. Exact source/security diff: new manual-only `.gitea/workflows/p05-custom-login-acceptance.yml`, CI image-only `deployment/docker/compose.login-ci.override.yaml`, focused new `tests/ci/login_image/{README.md,MINIFEST.md,build.sh,cleanup.sh}`, narrow opt-in `tests/ci/oidc_e2e/run.sh`. Original `auth/ui/v2/**`, `users/ui/**`, `core/**`, dev Compose, existing workflows, browser/provision/cleanup and package/locks unchanged. No public port, registry push, local application build/test, production, new real human or tag/release.
|
|
|
|
**Exactly ONE manual Gitea [Run #98](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/98) / Job #213** on source `fcfa59e826c39b445faa1b5b26c47ce715d8c3d6`: **COMPLETED FAILURE**, job started `2026-11-23T10:17:41Z`, completed `2026-11-23T10:24:00Z`. Step 0 CLI/Git SUCCESS; step 1 checkout SUCCESS; step 2 imported Login build/image SUCCESS; step 3 custom-image real OIDC FAILURE; step 4 `always()` dual owned-resource cleanup SUCCESS. No rerun or post-dispatch source patch.
|
|
|
|
| Gate | Actual status |
|
|
| --- | --- |
|
|
| Run-owned isolated builder preflight | **PASS** `ZITPLANE_CUSTOM_LOGIN_ISOLATED_BUILD_PREFLIGHT_PASS` |
|
|
| Frozen four-workspace PNPM install (1,121 packages) | **PASS** `ZITPLANE_CUSTOM_LOGIN_FROZEN_INSTALL_PASS` |
|
|
| NX proto/client/Next 16.4.6 standalone production build | **PASS** `ZITPLANE_CUSTOM_LOGIN_STANDALONE_BUILD_PASS` |
|
|
| Original upstream Dockerfile local image packaging | **PASS** `ZITPLANE_CUSTOM_LOGIN_LOCAL_IMAGE_BUILT_PASS` |
|
|
| Exact local image | `zitplane-login-ci:98`, image ID `sha256:ce910cca9bcbf125228c58143083314682b028e4851c9274e3f6a52154fa5a9a`; no registry publish |
|
|
| Docker/Compose no-public-port and owner config | **PASS** `ZITPLANE_OIDC_DOCKER_PREFLIGHT_PASS`, `ZITPLANE_OIDC_NO_PUBLISHED_PORT_AND_OWNER_CONFIG_PASS` |
|
|
| Disposable PostgreSQL and ZITADEL API startup | **PASS** (healthy from actual Compose events) |
|
|
| **Custom Login OCI process startup** | **FAIL**: `OCI runtime create failed: exec: "/app/entrypoint.sh": permission denied` |
|
|
| Custom Login health and actual running image ID | **NOT EXECUTED** (Compose failed before four-service ready gate) |
|
|
| Traefik private Host routing, forwarder, issuer | **NOT EXECUTED** |
|
|
| Official disposable project/client/test human | **NOT EXECUTED** |
|
|
| Chromium password Login V2, PKCE S256, state, nonce, Auth.js callback/session | **NOT EXECUTED** |
|
|
| Protected Account page/API, negative cases, logout | **NOT EXECUTED** |
|
|
| Existing OIDC/backend/credentials/DB/volumes/network cleanup | **PASS** `ZITPLANE_BACKEND_CLEANUP_VERIFIED_PASS`, `ZITPLANE_OIDC_ALL_RESOURCES_CLEANED_PASS` |
|
|
| New local image/builder/temporary context cleanup | **PASS** `ZITPLANE_CUSTOM_LOGIN_ALL_BUILD_RESOURCES_CLEANED_PASS` |
|
|
|
|
### Root cause confidence
|
|
|
|
The failure is **before the custom Login process started**; it cannot prove any authentication behavior or custom Login route. An executable-bit, file mode, ownership or other OCI execution-permission problem affecting `/app/entrypoint.sh` is **suspected**, not conclusively proven: Run #98 did NOT stat the copied artifact or built image. Do not invent a specific `0644` mode or change upstream source without evidence. Nonfatal imported Next.js Edge-runtime warnings did not prevent the successful build. The separate original-prebuilt Login V2 [Run #96](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/96) authenticated E2E SUCCESS remains valid.
|
|
|
|
**P05-OIDC-06: Source and one-run audit COMPLETE; custom image runtime ACCEPTANCE BLOCKED / FAILURE; mandatory cleanup PASS.** Production HTTPS, MFA/passkeys, Admin Console human flow and multi-app SSO remain outside this phase.
|
|
|
|
### Next proposed exact Scope Lock — P05-OIDC-06-A01 (not yet approved)
|
|
|
|
**Pre-source note:** create `notes/P05-OIDC-06-A01.md` first.
|
|
|
|
**SOURCE WRITE:** `tests/ci/login_image/build.sh` only; at most one focused new helper under `tests/ci/login_image/**` if justified. Documentation: `notes/**`, relevant `project/**`, `docs/**`, associated README/MINIFEST as necessary.
|
|
|
|
**STRICT READ-ONLY:** `auth/ui/v2/**` including upstream Dockerfile and original Login auth/source/lock, `users/ui/**`, `core/**`, all existing/new workflows, both Compose files, `tests/ci/oidc_e2e/**`, `tests/ci/login_image/cleanup.sh`, package manifests/locks, runner, production/secrets, unrelated files; preserve untracked `AI_INSTRUCTIONS.md`.
|
|
|
|
**Targeted action:** Inspect only numeric mode/owner/shebang class of the **copied temporary build-context** `.next/standalone/entrypoint.sh`. If evidence verifies missing executable bit, correct **only that temporary copy** with a narrowly checked `chmod 0755` (not imported upstream source or original Dockerfile). Verify built image `/app/entrypoint.sh` exists and `test -x` using a no-credentials `--entrypoint /bin/sh` probe; fail closed for anything else. After one focused source/security audit and commit/push, dispatch exactly one separately approved disposable custom Login CI run; verify actual container image/provenance, health, private Host/issuer, real project/client/human/Chromium PKCE/Auth.js session/negative/logout, both owned cleanups. No rerun, local build/test, real users, production, registry publish, tag or release.
|
|
|
|
**Docs SHA will differ from tested source SHA; the documentation commit is not runtime retested.**
|