From 485755800504a7dea6e4c303e6b39ec9cc610b54 Mon Sep 17 00:00:00 2001 From: Vib Tools Date: Sun, 22 Nov 2026 05:33:55 -0800 Subject: [PATCH] ci: record P05 run 83 and isolate disposable proxy from host ports --- .gitea/workflows/README.md | 2 +- .gitea/workflows/p05-ci.yml | 23 +++++++----- README.md | 2 +- docs/FEATURES-STATUS.md | 14 +++---- docs/MINIFEST.md | 2 +- docs/P05-CI-02.md | 17 ++++++++- docs/PHASES.md | 2 +- docs/SETUP-GUIDE.md | 3 ++ docs/TROUBLESHOOTING.md | 2 +- notes/CHANGELOG.md | 2 +- notes/MINIFEST.md | 2 +- notes/P05-CI-02.md | 49 ++++++++++++++++++++++++- project/CHANGELOG.md | 2 +- project/CI-ARCHITECTURE.md | 11 +++++- project/FILE-MAP.md | 3 +- project/SETUP-AND-DEPENDENCIES.md | 7 ++++ project/SOURCE-INVENTORY.md | 31 ++++++++-------- tests/ci/MINIFEST.md | 1 + tests/ci/README.md | 1 + tests/ci/compose.portless.override.yaml | 7 ++++ 20 files changed, 139 insertions(+), 44 deletions(-) create mode 100644 tests/ci/compose.portless.override.yaml diff --git a/.gitea/workflows/README.md b/.gitea/workflows/README.md index d1661e0..b6841da 100644 --- a/.gitea/workflows/README.md +++ b/.gitea/workflows/README.md @@ -8,7 +8,7 @@ Job responsibilities: 2. `login`: pinned pnpm workspace frozen install, proto/client/Login build and upstream unit checks. 3. `backend`: install Git before Alpine `checkout`, Docker daemon preflight, disposable local-only P02 ZITADEL Compose, ready/discovery/JWKS smoke and safe cleanup. **Full interactive OIDC login is NOT certified.** -**P05-CI-02 additions:** Account Portal CI negative route/API smoke, npm/pnpm structured Moderate advisory detail, and disposable Postgres restart persistence plus stronger OIDC issuer/JWKS negative checks. Full authenticated user sign-in/MFA remains deferred; only CI success counts as verified. +**P05-CI-02 additions:** Account Portal CI negative route/API smoke, npm/pnpm structured Moderate advisory detail, and disposable Postgres restart persistence plus stronger OIDC issuer/JWKS negative checks. Run #83 passed Account, Login V2 and Security jobs but backend proxy bind to shared host port 8080 failed after Postgres/ZITADEL/Login healthy. **Post-run source fix:** all backend Compose calls include `tests/ci/compose.portless.override.yaml` (`ports: !reset []`), config rejects any published proxy port; this is not CI-verified. Full authenticated user sign-in/MFA remains deferred. **Run #81 evidence:** backend's first revision failed during checkout because Alpine had no Git. Added a pre-checkout Git installation afterward; the corrected backend job remains **UNVERIFIED** until a separately approved CI rerun. See `docs/P05-CI-01.md`. diff --git a/.gitea/workflows/p05-ci.yml b/.gitea/workflows/p05-ci.yml index 82cc383..ab64f1c 100644 --- a/.gitea/workflows/p05-ci.yml +++ b/.gitea/workflows/p05-ci.yml @@ -156,22 +156,27 @@ jobs: set -eu project="zitplane-p05-${GITHUB_RUN_ID:-0}" python3 core/backend/zitadel/dev.py init - docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml config --quiet + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml config --quiet + # Hard CI isolation gate: never publish an inherited developer port + # on a shared Actions Docker host, even when 8080 is free. + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml config --format json | + python3 -c 'import json,sys; config=json.load(sys.stdin); assert not config["services"]["proxy"].get("ports"), "CI proxy unexpectedly publishes host ports"' + echo ZITPLANE_CI_PROXY_PORTLESS_CONFIG_PASS # Cleanup is allowed only after the preflight confirmed the network was absent. touch .p05-ci-started - docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml up -d --wait - docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml ps + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml up -d --wait + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml ps # The disposable Postgres volume must retain independently written data # after a database-container restart; this is NOT a production migration. - docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml \ + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml \ exec -T postgres psql -U zitadel -d postgres -v ON_ERROR_STOP=1 \ -c 'CREATE TABLE IF NOT EXISTS public.zitplane_ci_persist(marker text PRIMARY KEY)' - docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml \ + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml \ exec -T postgres psql -U zitadel -d postgres -v ON_ERROR_STOP=1 \ -c "INSERT INTO public.zitplane_ci_persist(marker) VALUES ('p05-$project') ON CONFLICT DO NOTHING" - docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml restart postgres - docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml up -d --wait - marker="$(docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml \ + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml restart postgres + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml up -d --wait + marker="$(docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml \ exec -T postgres psql -U zitadel -d postgres -tAc 'SELECT marker FROM public.zitplane_ci_persist LIMIT 1')" test "$marker" = "p05-$project" echo ZITPLANE_POSTGRES_RESTART_PERSISTENCE_PASS @@ -187,7 +192,7 @@ jobs: cleanup_rc=0 if [ -f .p05-ci-started ] && [ -f .env ]; then project="zitplane-p05-${GITHUB_RUN_ID:-0}" - docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml down -v --remove-orphans || cleanup_rc=1 + docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml -f tests/ci/compose.portless.override.yaml down -v --remove-orphans || cleanup_rc=1 fi rm -f .env .p05-ci-started if [ "$cleanup_rc" -ne 0 ]; then diff --git a/README.md b/README.md index 597aa57..88c0dde 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Compact, developer-friendly monorepo for a central identity service, a branded l - **P03 Login V2 source:** official v4.20.4 source and matching client/proto workspace imported under `auth/ui/v2/`; no redesign or runtime build/test was performed. **CI validation remains pending.** - **P04 Account Portal:** Next.js + ZITADEL OIDC Auth.js source, server-protected overview/profile/security pages and compact responsive foundation implemented under `users/ui/`. **No build/test/runtime validation yet; future Gitea Actions required.** - **P05-CI-01:** Manual Gitea Run #81 **overall FAILURE**: Login V2 build + 1219 unit tests PASS, high/critical gate PASS (18 Moderate Login findings), Account Auth.js TS2345 and Docker checkout FAIL. Details: `docs/P05-CI-01.md`. -- **P05-CI-02:** Narrow Auth.js JWT subject typing correction and a single-run Gitea verification enhancement for anonymous Account access, disposable PostgreSQL restart, OIDC discovery/JWKS negative cases and per-advisory triage. **Acceptance pending CI results**, full interactive user login/MFA E2E excluded. Details: `docs/P05-CI-02.md`. +- **P05-CI-02:** Gitea Run #83 **3 PASS / 1 FAIL**. Account Portal typecheck/build and negative identity checks PASS; Login V2 build + 1219/1219 tests PASS; High/Critical security threshold PASS (18 Moderate Login records + 1 Moderate Account package OPEN). Docker Postgres/ZITADEL API/Login healthy, but shared runner port 8080 blocked Traefik; cleanup PASS. CI-only portless override added afterward **not CI-verified**; full OIDC E2E deferred. See `docs/P05-CI-02.md`. - **Production / Coolify:** not configured or deployed. ## Documentation and project knowledge diff --git a/docs/FEATURES-STATUS.md b/docs/FEATURES-STATUS.md index 9ff7305..239dab7 100644 --- a/docs/FEATURES-STATUS.md +++ b/docs/FEATURES-STATUS.md @@ -1,24 +1,24 @@ # ZitPlane - Actual feature availability / limitations -Snapshot: 2026-11-22, P05-CI-02 source preparation based on baseline `42adaba`. New patch acceptance pending a focused Gitea Actions run. **SOURCE EXISTS != RUNNING != VERIFIED != PRODUCTION**. +Snapshot: 2026-11-22, P05-CI-02 Gitea Run #83 on source SHA `c27fe3d` (3 PASS / 1 FAIL); post-run CI-only portless patch remains unverified. **SOURCE EXISTS != RUNNING != VERIFIED != PRODUCTION**. | Feature | Source present | CI/build verified | Live/deployed | | --- | --- | --- | --- | -| Official ZITADEL Go backend image configuration | Yes, P02 | No | No | -| Local PostgreSQL and loopback Traefik stack | Yes, P02 | No | No | +| Official ZITADEL Go backend image configuration | Yes, P02 | Run #83 ZITADEL API healthy in disposable Docker; full startup/proxy/OIDC acceptance blocked | No | +| Local PostgreSQL and loopback Traefik stack | Yes, P02 | Run #83 Postgres healthy, Traefik host 8080 collision; DB restart untested | No | | Official prebuilt Login V2 service in local Compose | Yes, P02 configuration | No | No | | Official Login V2 customisable source | Yes, P03 v4.20.4 | Run #81 build + 1219/1219 unit tests PASS; integration not verified | No | | Login V2 signup/password/OTP/MFA/passkey/IDP source routes | Present upstream | Run #81 unit suite PASS; real account flows NOT tested | No | -| Custom Account Portal Next.js app | Yes, P04 | No | No | +| Custom Account Portal Next.js app | Yes, P04 | Run #83 npm ci/typecheck/Next production build PASS | No | | Portal login OIDC and Auth.js callbacks | Yes, P04 source | No | No | | Portal Overview / Profile / Security pages | Yes, P04 | No | No | -| Read-only `GET /api/account/me` | Yes, P04 | No | No | +| Read-only `GET /api/account/me` | Yes, P04 | Run #83 anonymous 401/no-store and redirect negative cases PASS; positive auth unverified | No | | Password/MFA/passkey changes *inside* Account Portal | No | N/A | No | | Mutable profile editing / device sessions / identity deletion | No | N/A | No | | Global ZITADEL SSO logout | No | N/A | No | | Subscriptions, payments and SaaS billing | Outside ZitPlane scope | N/A | No | -| Gitea Actions CI verification workflow | Yes, P05 manual dispatch | Run #81 completed: 2 PASS / 2 FAIL; overall FAILURE | Not deployed | -| Gitea Actions CI and isolated integration tests | Verification scripts prepared; full OIDC E2E absent | Run #81 backend checkout failed; runtime acceptance BLOCKED | No | +| Gitea Actions CI verification workflow | Yes, P05 manual dispatch | Run #83: 3 PASS / 1 FAIL; Docker proxy 8080 collision, cleanup PASS | Not deployed | +| Gitea Actions CI and isolated integration tests | Negative tests/ready/persistence probe source prepared; full interactive OIDC E2E absent | Run #83: Postgres/ZITADEL API/Login healthy; proxy port collision prevented persistence/OIDC smoke; runtime BLOCKED | No | | Coolify production stack, TLS, routing and backups | No | No | No | | Public `auth.vib.tools/login` URL | Proposed only | No | No | | Public `account.vib.tools` account website | Proposed only | No | No | diff --git a/docs/MINIFEST.md b/docs/MINIFEST.md index b80e378..8d1a441 100644 --- a/docs/MINIFEST.md +++ b/docs/MINIFEST.md @@ -8,7 +8,7 @@ Every file listed below is a direct child of `docs/`. Add/remove rows whenever t | [MINIFEST.md](MINIFEST.md) | Direct-file manifest and phase ownership | DOCS-01 / active | | [USER-GUIDE.md](USER-GUIDE.md) | Source-grounded Account Portal page/button-by-button manual | DOCS-01 / active; runtime pending | | [P05-CI-01.md](P05-CI-01.md) | Gitea Actions manual verification workflow, gates, limitations and real run evidence | P05-CI-01 / Run #81 complete, acceptance blocked | -| [P05-CI-02.md](P05-CI-02.md) | TypeScript remediation, Gitea CI verification, dependency risk and isolation evidence | P05-CI-02 / awaiting CI | +| [P05-CI-02.md](P05-CI-02.md) | TypeScript remediation, Gitea CI verification, dependency risk and isolation evidence | P05-CI-02 / run #83 done; Docker acceptance blocked | | [SETUP-GUIDE.md](SETUP-GUIDE.md) | Operator/developer prerequisites, configs, activation and safety | DOCS-01 / active; runtime pending | | [FEATURES-STATUS.md](FEATURES-STATUS.md) | Exact implemented/unavailable/unverified feature matrix | DOCS-01 / active | | [TROUBLESHOOTING.md](TROUBLESHOOTING.md) | Known blockers and safe diagnosis based on source status | DOCS-01 / active | diff --git a/docs/P05-CI-02.md b/docs/P05-CI-02.md index 74a13c3..60783cc 100644 --- a/docs/P05-CI-02.md +++ b/docs/P05-CI-02.md @@ -2,7 +2,7 @@ **Date:** 2026-11-22 **Baseline:** `42adaba0044ee5cb86e6e6bcfd4e00e5fe96ad00` -**State:** Source prepared; Gitea acceptance run pending. +**State:** Gitea Run #83 complete (3 PASS / 1 FAIL), Docker port conflict; post-run portless CI-only source fix unverified. ## What changed and why @@ -23,4 +23,17 @@ The workflow uses a fixed P02 dev network, so it refuses to start when that netw ## Actual Gitea run evidence -**PENDING.** Record run ID/SHA, individual terminal job results, real advisory IDs, persistence/cleanup evidence and exact blockers after the single focused CI cycle. See `notes/P05-CI-02.md` for the detailed phase record. +**Run #83:** [Gitea Actions Run #83](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/83), `workflow_dispatch`, 2026-11-22, source SHA `c27fe3d3234d16375b962b88014cdd8733ab2fb4`. Overall **FAILURE** with **3 jobs PASS / 1 FAIL**. + +| Job | Result | Verified evidence | +| --- | --- | --- | +| Account Portal (#171) | **PASS** | npm lock/source guard PASS; `npm ci`, `tsc --noEmit`, Next.js production build PASS; anonymous `/api/account/me` HTTP 401/no-store and protected redirect to `/signin` PASS. B01 TypeScript defect resolved | +| Official Login V2 (#172) | **PASS** | Frozen pnpm install, proto/client/Login V2 standalone production build; Vitest **84/84 files and 1219/1219 tests PASS** | +| Security (#173) | **PASS at HIGH/CRITICAL threshold** | 0 HIGH/CRITICAL in production audits; **18 Moderate Login advisory records** and **1 Moderate Account `next` package** identified; not fixed | +| Disposable Docker (#174) | **FAIL** | Alpine Git/checkout, Docker daemon/preflight, P02 Python contracts, images pull, PostgreSQL health, ZITADEL API and Login V2 health PASS. Traefik proxy failed host bind `0.0.0.0:8080` **port already allocated**. Restart/persistence and OIDC discovery/JWKS **NOT EXECUTED**. Always cleanup removed job-owned containers, network and named volumes | + +**Post-run source-only correction (not verified):** added `tests/ci/compose.portless.override.yaml` with official Compose `ports: !reset []`; all backend CI Compose commands now include it, and config verifies that Traefik has no inherited host publishing. The developer Compose remains untouched. Official reference: https://docs.docker.com/reference/compose-file/merge/#reset-value. + +**Outstanding:** CI-only portless override needs one separately approved verification run; database restart persistence and real OIDC discovery remain unverified. Full interactive login, OIDC callback, MFA and Admin Console login require a separate disposable E2E integration plan. All Moderate advisories require a reviewed dependency-only remediation phase before production acceptance. + +Detailed advisory IDs/ranges and disposition: `notes/P05-CI-02.md`. **No second CI run**, no local tests/builds/Docker, no production deployment. diff --git a/docs/PHASES.md b/docs/PHASES.md index 308576e..13cfae6 100644 --- a/docs/PHASES.md +++ b/docs/PHASES.md @@ -44,7 +44,7 @@ Implement one explicitly approved phase at a time. Keep out-of-scope files, exis - Baseline `42adaba0044ee5cb86e6e6bcfd4e00e5fe96ad00` (Gitea `main`). - Narrow write scope: `users/ui/src/auth.ts`, optional `src/types/next-auth.d.ts`, `.gitea/workflows/p05-ci.yml`, `tests/ci/**`, `notes/**`, `project/**`, relevant `docs/**`, associated CI README/MINIFEST, root navigation only if required. - B01 Auth.js TypeScript TS2345: real subject string narrowing, preserve PKCE/state/nonce, expiry and protected identity guard. B02: verify in-CI Docker checkout, disposable ZITADEL, PostgreSQL restart persistence and OIDC discovery/JWKS. B03: report real Moderate advisory IDs/package/fix; HIGH+ security threshold remains a failure gate. B04: negative OIDC metadata and anonymous Account Portal checks, with interactive user E2E explicitly deferred. -- One focused manually triggered Gitea Actions cycle, no local builds/tests/Docker, no production deployment. Exact result: `notes/P05-CI-02.md`, `docs/P05-CI-02.md`; blocked results remain blocked. +- **One** manual Gitea Run #83: Account Portal, Login V2, security gates PASS; Docker health progressed to PostgreSQL/ZITADEL API/Login V2 healthy, but runner host 8080 collision blocked proxy, database persistence and discovery. Full CI acceptance BLOCKED. Post-run CI-only `tests/ci/compose.portless.override.yaml` clears inherited host port, **not CI-verified**. 18 Moderate Login + 1 Moderate Account audit record still open, no package changes. Exact evidence in `notes/P05-CI-02.md`, `docs/P05-CI-02.md`. ## P05 - Full Integration (proposed, NOT approved) Shared design system, production-safe Compose topology and verified Login/Account OIDC wiring. No live deployment; separate approval. diff --git a/docs/SETUP-GUIDE.md b/docs/SETUP-GUIDE.md index 369016f..d7ce791 100644 --- a/docs/SETUP-GUIDE.md +++ b/docs/SETUP-GUIDE.md @@ -65,3 +65,6 @@ A manual-only workflow is defined in `.gitea/workflows/p05-ci.yml`. In Gitea go ## Acceptance and configuration troubleshooting Refer to [FEATURES-STATUS.md](FEATURES-STATUS.md), [TROUBLESHOOTING.md](TROUBLESHOOTING.md), `docs/P02-EVIDENCE.md` and `docs/P04-ACCOUNT-PORTAL.md`. Do not claim success on a missing-run check. Future changes must update all affected docs and developer records. + + +**P05-CI-02 status (2026-11-22):** Run #83 verified Account Portal build/typecheck and negative auth checks, Login V2 1219/1219 unit tests and a successful high/critical dependency threshold (Moderate issues still open). Disposable Postgres/ZITADEL API/Login V2 became healthy, but host TCP 8080 prevented proxy startup; cleanup succeeded. The workflow now has a **CI-only** portless override to allow internal-Docker-network probing on a shared runner, **not yet rerun**. See `docs/P05-CI-02.md`. This is not a production deployment guide. diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index 9908148..965ca40 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -23,7 +23,7 @@ Include environment (local disposable vs CI vs production), exact phase/commit, ## P05-CI-02 verification and error boundaries - Prior Account Portal `TS2345` at `src/auth.ts(14,61)` in Gitea Run #81 was caused by the callback returning a JWT subject not statically narrowed to `string`. P05-CI-02 source narrows it with `typeof`; it is not considered fixed until CI typecheck/build passes. -- Previous Alpine backend checkout missed Git; current workflow installs Git before checkout. Docker readiness/persistence must be proved by the new CI run, not inferred from this change. +- Previous Alpine backend checkout missed Git; Run #83 verified the fix. Postgres/ZITADEL API/prebuilt Login V2 became healthy, but the runner had host TCP 8080 allocated and Traefik could not start. A CI-only portless Compose override was added after Run #83; it is **not verified** until a separately approved run. Database restart/persistence and OIDC discovery were not reached. - A green HIGH/CRITICAL advisory audit gate still allows Moderate findings; the P05-CI-02 registry detail report records IDs/package/fix separately, without package upgrades. - CI negative access tests do not simulate real login; actual OIDC app registration/authorized login/MFA must receive separate approval. diff --git a/notes/CHANGELOG.md b/notes/CHANGELOG.md index e1c2a48..2c0bf15 100644 --- a/notes/CHANGELOG.md +++ b/notes/CHANGELOG.md @@ -10,6 +10,6 @@ This is the chronological **index**. Phase-specific scope/implementation evidenc | 2026-11-22 | P04 | Account Portal OIDC and protected frontend foundation | `40af500`; patch/scope audit, CI deferred | | 2026-11-22 | DOCS-01 | Knowledge folders, first-party file/function maps, exact source inventory, user guides and mandatory AGENTS documentation policy | Documentation implementation complete; focused manifest/link/scope audit PASS; Git SHA in DOCS-01 local commit, see [DOCS-01.md](DOCS-01.md) | | 2026-11-22 | P05-CI-01 | Gitea verification workflow, dependency lock reconciliation, narrow checkout remediation | Run #81: 2 PASS/2 FAIL; 1219 Login tests PASS, Account TS2345 and Docker checkout blocked; see [P05-CI-01.md](P05-CI-01.md) | -| 2026-11-22 | P05-CI-02 | Narrow Auth.js TS2345 fix, disposable backend persistence/OIDC negative CI and Moderate advisory triage | Implementation in progress; see [P05-CI-02.md](P05-CI-02.md) | +| 2026-11-22 | P05-CI-02 | Narrow Auth.js TS2345 fix, CI negative tests, advisory triage and post-run portless override | Run #83: Account/Login/Security PASS, Docker FAIL on host 8080; cleanup PASS; portless override unverified. [Evidence](P05-CI-02.md) | Rules: Append new phases or fixes; never silently rewrite a past result. Separate **implemented**, **verified**, **blocked**, and **proposed**. Never log a user secret or personal data. diff --git a/notes/MINIFEST.md b/notes/MINIFEST.md index b7bbe28..6dc153a 100644 --- a/notes/MINIFEST.md +++ b/notes/MINIFEST.md @@ -6,7 +6,7 @@ | [MINIFEST.md](MINIFEST.md) | File list and ownership; **MINIFEST is the exact required filename** | DOCS-01 / active | | [DOCS-01.md](DOCS-01.md) | This documentation-governance change: baseline, scope, plan, implementation and closure | DOCS-01 / implementation complete | | [P05-CI-01.md](P05-CI-01.md) | Scope/roots, allowed paths, implementation and Gitea CI acceptance evidence | P05-CI-01 / source complete, CI blockers open | -| [P05-CI-02.md](P05-CI-02.md) | Auth.js narrow patch, isolated Gitea CI gate, advisory triage and exact acceptance evidence | P05-CI-02 / in progress | +| [P05-CI-02.md](P05-CI-02.md) | Auth.js narrow patch, isolated Gitea CI gate, advisory triage and exact acceptance evidence | P05-CI-02 / run #83 completed; residual Docker gate blocked | | [CHANGELOG.md](CHANGELOG.md) | Short append-only chronological phase log and links to detailed reports | DOCS-01 / active | Update this manifest whenever any direct child file or directory changes. Use **actual source state**; a planned file must be labeled planned, not present. diff --git a/notes/P05-CI-02.md b/notes/P05-CI-02.md index d8a0175..27c42bf 100644 --- a/notes/P05-CI-02.md +++ b/notes/P05-CI-02.md @@ -2,7 +2,7 @@ **Date:** 2026-11-22 **Baseline:** `42adaba0044ee5cb86e6e6bcfd4e00e5fe96ad00` (local `main` = Gitea `main`) -**State:** APPROVED / PRE-CHANGE SCOPE LOCK +**State:** IMPLEMENTATION COMMITTED AND RUN #83 COMPLETED (3 PASS / 1 FAIL); post-run CI-only port fix pending acceptance **Previous CI evidence:** Gitea Run [#81](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/81), tested `42b79362c13b9dbb07f85a58ad278742d91b1f5b`, overall FAILURE. ## Exact approved write scope @@ -34,3 +34,50 @@ READ ONLY: `core/backend/zitadel/dev.py`, `deployment/docker/compose.backend.dev ## Verification ledger **NOT STARTED.** Record run ID/SHA, exact terminal job statuses, advisory IDs and severity, Docker persistence/cleanup, remaining blockers and final Git SHA only after real evidence is received. + + +## Actual Gitea CI acceptance cycle — Run #83 + +**Event:** `workflow_dispatch` on `main` +**Tested source SHA:** `c27fe3d3234d16375b962b88014cdd8733ab2fb4` +**Run:** https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/83 +**Terminal:** 2026-11-22 13:28:49 UTC, **overall FAILURE**, 3 jobs PASS / 1 FAIL. +**No second run was started.** + +| Job | Job ID | Conclusion | Evidence | +| --- | ---: | --- | --- | +| Account Portal | 171 | **PASS** | Source/lock guards, npm ci, `tsc --noEmit`, Next production build, anonymous GET `/api/account/me` 401/no-store, protected route redirect | +| Login V2 | 172 | **PASS** | Pinned pnpm frozen install, Nx proto/client/Login V2 standalone build; Vitest **84/84 files, 1219/1219 tests PASS** | +| Dependency security | 173 | **PASS at HIGH/CRITICAL only** | Account npm audit 1 Moderate vulnerable `next`; Login pnpm 18 Moderate advisory records; neither has HIGH/CRITICAL at the reported audit date | +| Disposable Docker | 174 | **FAIL** | Git/checkout, Docker preflight, 3 Python P02 static tests, official image pulls, PostgreSQL, ZITADEL API and prebuilt Login V2 **HEALTHY**. Traefik proxy failed: `Bind for 0.0.0.0:8080 failed: port is already allocated`. Postgres marker write/restart/persistence and OIDC discovery/JWKS **NOT REACHED**. Always-cleanup **PASS**: job-owned containers, network, volumes removed | + +**B01 disposition:** FIXED and CI typecheck/build **verified PASS**. No TypeScript config relaxation, unsafe cast, PKCE/nonce/state change, session expiration bypass or UI change. + +**B02 disposition:** Git checkout fixed and verified; PostgreSQL, ZITADEL API, Login V2 reached healthy state. Port 8080 was occupied on shared Docker runner; scope did not permit editing P02 Compose. **After the terminal run**, added a narrow CI-only `tests/ci/compose.portless.override.yaml` with `proxy.ports: !reset []` and applied it consistently to all 9 workflow Compose commands; enforced effective config `proxy.ports` empty before startup. Official Docker Compose documented reset behavior: https://docs.docker.com/reference/compose-file/merge/#reset-value. **This source fix is NOT VERIFIED by CI**, and the remaining persistence/discovery gates are BLOCKED until a separately approved run. P02 developer Compose remains untouched. + +### B03 — exact live registry advisory triage (2026-11-22) + +**Account Portal npm audit:** 1 Moderate affected `next` package, pinned `16.4.3`, affected `16.0.0–16.4.4`, npm advises `16.4.6`: +`GHSA-mfr8-8qww-v76h`, `GHSA-vc7v-qv4w-wrv8`, `GHSA-7qx7-33qx-rqx2`, `GHSA-f3mh-rxg3-f5g2`, `GHSA-pc58-hwjq-p385`, `GHSA-rhh4-g77r-r9qj`, `GHSA-vvgp-ww4w-46vf`. Seven advisory IDs are grouped into **one affected npm package record**, not seven separate npm packages. + +**Login V2 pnpm audit: 18 Moderate advisory records**, grouped as follows: + +| Count | Package(s) | Advisory | Vulnerable range → patched version | +| ---: | --- | --- | --- | +| 8 | `@opentelemetry/instrumentation-pg`, `-mysql2`, `-knex`, `-mysql`, `-mongoose`, `-oracledb`, `-tedious`, `-cassandra-driver` | `GHSA-qqmp-wf37-98f9` | pg <0.73.0 → ≥0.73.0; mysql2/mysql/mongoose <0.67.0 → ≥0.67.0; knex <0.65.0 → ≥0.65.0; oracledb <0.46.0 → ≥0.46.0; tedious <0.40.0 → ≥0.40.0; cassandra-driver <0.66.0 → ≥0.66.0 | +| 1 | `@opentelemetry/instrumentation-http` | `GHSA-3v2p-hm54-8qcq` | >0.204.0 <0.222.0 → ≥0.222.0 | +| 1 | `glob` | `GHSA-3g3m-2fjr-6pw4` | ≥9.0.0 ≤14.0.1 → ≥14.0.2 | +| 1 | `minimatch` | `GHSA-g3hv-75wg-m249` | ≥7.0.0 <11.0.1 → ≥11.0.1 | +| 7 | `next` | Seven `GHSA` IDs listed above | Next.js 16.x ≤16.4.4 (ranges differ) → pnpm reports ≥16.4.5 | + +**Disposition:** all 19 Moderate audit records (18 Login + 1 Account package record) remain OPEN; HIGH/CRITICAL gate passed. Fixed-version metadata is a candidate only, not proof of compatibility or runtime exploitability. No blind npm/pnpm dependency upgrades, upstream Login fork edits or lockfile changes in P05-CI-02. A separate dependency-only security phase must evaluate reachability, runtime vs tooling transitive paths, pin consistency with official upstream, package/lock changes and CI regression. + +### Phase closure, outstanding blockers + +- B01 **CLOSED**, account typecheck/build/anonymous access verified. +- B02 **PARTIALLY VERIFIED** (checkout + health), but fixed portless CI overlay, restart persistence and OIDC/JWKS smoke remain **UNVERIFIED**; full backend gate FAIL. +- B03 **TRIAGE COMPLETE**, 19 Moderate records remain open pending approved dependency remediation; High/Critical gates PASS. +- B04 **PARTIALLY VERIFIED** (anonymous Account checks + synthetic negative OIDC metadata contracts in source); live Docker OIDC discovery/keys NOT RUN; authenticated client/user callback, MFA, Admin Console and federated logout **DEFERRED**. +- No live user data, production network, production host, Coolify deployment, tags, releases or local application tests/builds used. **No Gitea run rerun**. Untracked `AI_INSTRUCTIONS.md` preserved. + +**Post-run commit:** contains only approved CI overlay/workflow and accurate notes/project/docs, no core/Compose/manifest/lock changes. The new commit SHA is recorded in Git history; **Run #83 tested `c27fe3d`, not the later documentation/portless patch SHA.** diff --git a/project/CHANGELOG.md b/project/CHANGELOG.md index c225a89..c58f826 100644 --- a/project/CHANGELOG.md +++ b/project/CHANGELOG.md @@ -10,7 +10,7 @@ This is the **developer-focused implementation history**. `notes/CHANGELOG.md` i | 2026-11-22 | P04 | `users/ui/` Account Portal OIDC, pages, styling, read-only identity API | `40af500`; `docs/P04-ACCOUNT-PORTAL.md`; no build/CI | | 2026-11-22 | DOCS-01 | Documentation governance; developer architecture, reviewed first-party function/file/page mapping and 701-path source inventory; user manual/setup/status/troubleshooting | Documentation complete; manifest/link/source-scope audit PASS; `notes/DOCS-01.md`, local commit SHA via Git history | | 2026-11-22 | P05-CI-01 | `.gitea/workflows/p05-ci.yml`, `tests/ci/**`, Account npm lock, Login pnpm importer reconciliation and in-scope Alpine Git checkout correction | Run #81 overall FAIL; 2 jobs PASS, 2 FAIL; Login 1219/1219 tests PASS, Account TS2345 and Docker checkout blocked; `notes/P05-CI-01.md` | -| 2026-11-22 | P05-CI-02 | Type-safe Auth.js subject narrowing; Gitea CI negative API/OIDC tests, Postgres restart persistence and Moderate advisory detail inventory | CI result pending; `notes/P05-CI-02.md`, `docs/P05-CI-02.md` | +| 2026-11-22 | P05-CI-02 | Type-safe Auth.js subject narrowing, Account anonymous negative tests, Login regression, structured advisory triage and CI-only portless Docker override | Run #83: 3 PASS/1 FAIL; Docker proxy 8080 collision, cleanup PASS, portless fix unverified; see `notes/P05-CI-02.md` | ## Required entry for each future change diff --git a/project/CI-ARCHITECTURE.md b/project/CI-ARCHITECTURE.md index c034124..a761745 100644 --- a/project/CI-ARCHITECTURE.md +++ b/project/CI-ARCHITECTURE.md @@ -1,6 +1,6 @@ # ZitPlane P05-CI-01 - Gitea Actions verification architecture -**Status:** source implemented; Gitea Run #81 completed overall FAILURE (Login and high/critical security jobs PASS; Account and backend checkout FAIL). Follow-up acceptance pending. **Approved baseline:** `7ecf53169776cc7f08af3dde6fe4b4492acf3ea1` (2026-11-22). +**Status:** P05-CI-01 Run #81 overall FAIL; P05-CI-02 Run #83 **3 PASS / 1 FAIL** (Account, Login, Security pass; backend proxy host-port collision). CI-only portless source correction after Run #83 remains unverified. Full OIDC and runtime acceptance pending. **Approved baseline:** `7ecf53169776cc7f08af3dde6fe4b4492acf3ea1` (2026-11-22). ## Exact job map @@ -51,3 +51,12 @@ Reference: `notes/P05-CI-01.md`, `docs/PHASES.md`, `.gitea/workflows/p05-ci.yml` Initial dispatched commit `42b79362c13b9dbb07f85a58ad278742d91b1f5b`. Two PASS: Login V2 frozen reproducible install, production build and 1219/1219 upstream unit tests; dependency advisory gate at high/critical only (18 moderate findings outstanding). Two FAIL: Account Portal TS2345 Auth.js session callback type mismatch; Alpine backend actions/checkout fallback `Not found` because Git missing before checkout. The Docker runtime and full interactive OIDC flow **were not executed**. Pre-checkout Git install inserted in the backend workflow after this failed run; this is only a **source fix** until a future run actually passes. Reference `docs/P05-CI-01.md` for job numbers and `notes/P05-CI-01.md` for the next phase defect IDs. There was no second CI run or local test. + + +## P05-CI-02 Run #83 final evidence and post-run portless exception + +Gitea [Run #83](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/83) on SHA `c27fe3d3234d16375b962b88014cdd8733ab2fb4`: three job PASS (Account `npm ci`/typecheck/build/anonymous 401 and protected redirect; Login V2 frozen/Nx build + **1219 tests**; HIGH/CRITICAL security audit with 18 Moderate Login records and 1 Moderate Account package); Docker job FAIL after Postgres, ZITADEL API and prebuilt Login V2 reported healthy. Traefik proxy attempted to bind occupied runner TCP 8080. Always cleanup removed only job-owned containers, network and volumes; persistence and OIDC discovery were not reached. + +**Only after that run**, a P05-scoped CI overlay at `tests/ci/compose.portless.override.yaml` set `proxy.ports: !reset []`, as documented by Docker Compose: https://docs.docker.com/reference/compose-file/merge/#reset-value. Every backend workflow Compose call now includes this override; a fail-closed effective-config probe rejects any inherited host port. The P02 Compose and application logic remain untouched. **Post-run override has not been CI tested.** New exact Gitea main commit is documentation/source only and must not be described as the tested Run #83 SHA. + +Unresolved: one separately approved isolated backend re-verification cycle for the portless override, Postgres restart persistence and live OIDC/JWKS; distinct disposable authenticated OIDC/client/user + MFA E2E; targeted dependency-only security remediation of Moderate findings (no upgrades in P05-CI-02). diff --git a/project/FILE-MAP.md b/project/FILE-MAP.md index 99233f1..1f55b5d 100644 --- a/project/FILE-MAP.md +++ b/project/FILE-MAP.md @@ -101,7 +101,8 @@ These paths describe **source**, not a verified running app. Do not infer API co | Path | Verified narrow function | | --- | --- | | `users/ui/src/auth.ts` | `callbacks.session` optional JWT subject type narrowing; no change to provider, policy or PKCE/state/nonce | -| `.gitea/workflows/p05-ci.yml` | CI-only Account negative smoke, Postgres restart persistence, registry advisory JSON collection and cleanup status | +| `.gitea/workflows/p05-ci.yml` | CI-only Account negative smoke, Postgres restart persistence, registry advisory JSON collection, portless Compose config and cleanup status | +| `tests/ci/compose.portless.override.yaml` | Post-run CI-only removal of inherited developer Traefik host port 8080; unverified until next CI run | | `tests/ci/account_negative.py` | Anonymous API 401 and protected route redirect CI probe | | `tests/ci/advisory_triage.py` | Nonmutating npm/pnpm vulnerability inventory with IDs and patch availability | | `tests/ci/oidc_discovery.py` | Read-only disposable issuer/JWKS negative validation and live metadata smoke | diff --git a/project/SETUP-AND-DEPENDENCIES.md b/project/SETUP-AND-DEPENDENCIES.md index 88b3c80..f23ee00 100644 --- a/project/SETUP-AND-DEPENDENCIES.md +++ b/project/SETUP-AND-DEPENDENCIES.md @@ -42,3 +42,10 @@ The P03 upstream `pnpm-lock.yaml` contained 8 importer metadata records but the ## Pending checks before any release Version security review, reproducible installs, TypeScript/typecheck, Next.js build, OIDC state/PKCE, callback, token expiry, local vs global logout, self-service access, routing, secrets handling, production TLS, backup/restore, monitoring, and isolated Gitea CI verification. No current public deployment exists per recorded phase evidence. + + +## P05-CI-02 current checked results (2026-11-22) + +Gitea Run #83 proved Account Portal TypeScript and Next.js production build, anonymous identity API 401/no-store and protected route redirect. Login V2 frozen build/standalone and upstream unit tests 1219/1219 passed. Dependency audits exposed 1 Moderate Account `next` vulnerable package (npm recommends Next.js 16.4.6) and 18 Moderate Login workspace records (seven Next.js GHSA IDs, eight OpenTelemetry driver instrumentation records, one OpenTelemetry HTTP, `glob`, `minimatch`). No dependency package/lock versions were changed. + +The runner's published TCP 8080 was already in use, so P02's local-only Traefik mapping prevented the CI proxy from starting even though PostgreSQL, ZITADEL API and Login V2 became healthy. A **CI-only** two-file Compose merge uses `tests/ci/compose.portless.override.yaml` to clear `proxy.ports`; config asserts that no host ports will be published. This was added after Run #83 and remains **unverified**. Live DB restart/data persistence and discovery checks have not passed. No production secrets or volumes were accessed. diff --git a/project/SOURCE-INVENTORY.md b/project/SOURCE-INVENTORY.md index 12d926f..b39b42a 100644 --- a/project/SOURCE-INVENTORY.md +++ b/project/SOURCE-INVENTORY.md @@ -1,25 +1,25 @@ # Source inventory ? all Git-tracked paths -**Snapshot:** 2026-11-22, P05-CI-02 staged source on baseline `42adaba`; before final CI acceptance. +**Snapshot:** 2026-11-22, P05-CI-02 post-Run #83 documentation and CI-only portless correction based on tested `c27fe3d`. This source change has not been retested. -**Exact tracked file paths: 718.** This is a locator and does not assert every upstream file/function was independently audited or tested. Untracked `AI_INSTRUCTIONS.md` and ignored secrets are excluded. +**Tracked paths: 719.** Exact Git-index path list; untracked `AI_INSTRUCTIONS.md` and ignored secrets excluded. Source existence does not prove runtime acceptance. | Top-level group | Files | Ownership | | --- | ---: | --- | -| `(repository root)` | 6 | Git-tracked content | -| `.gitea` | 5 | Gitea manual CI files | -| `auth` | 639 | Original Login V2 upstream imports | -| `core` | 2 | ZITADEL backend orchestration | +| `(repository root)` | 6 | Repository root | +| `.gitea` | 5 | Gitea manual CI workflows | +| `auth` | 639 | Upstream Login V2 import | +| `core` | 2 | Backend config/helper | | `deployment` | 2 | Dev-only Docker Compose | -| `docs` | 14 | Operator/user guides and CI evidence | -| `notes` | 6 | Pre-change plans and phase logs | -| `packages` | 1 | Shared package placeholder | -| `project` | 10 | Developer architecture and source map | -| `scripts` | 1 | Script placeholder | -| `tests` | 8 | Backend and CI scripts | -| `users` | 24 | Account Portal and Auth.js | +| `docs` | 14 | User/operator docs | +| `notes` | 6 | Phase scope and evidence | +| `packages` | 1 | Shared packages placeholder | +| `project` | 10 | Developer source map | +| `scripts` | 1 | Scripts placeholder | +| `tests` | 9 | CI verification scripts | +| `users` | 24 | Account Portal | -## Exact Git-tracked paths +## Exact tracked paths ### (repository root) ? 6 files @@ -737,13 +737,14 @@ - `scripts/README.md` -### tests ? 8 files +### tests ? 9 files - `tests/README.md` - `tests/ci/MINIFEST.md` - `tests/ci/README.md` - `tests/ci/account_negative.py` - `tests/ci/advisory_triage.py` +- `tests/ci/compose.portless.override.yaml` - `tests/ci/oidc_discovery.py` - `tests/ci/source_contract.py` - `tests/test_backend_dev.py` diff --git a/tests/ci/MINIFEST.md b/tests/ci/MINIFEST.md index f120fcd..715c252 100644 --- a/tests/ci/MINIFEST.md +++ b/tests/ci/MINIFEST.md @@ -8,3 +8,4 @@ | [oidc_discovery.py](oidc_discovery.py) | Disposable ZITADEL ready/discovery/JWKS plus malformed issuer/JWKS negative contracts | P05-CI-01/P05-CI-02 | | [account_negative.py](account_negative.py) | CI-only Account Portal unauthenticated 401/protected redirect smoke | P05-CI-02 | | [advisory_triage.py](advisory_triage.py) | Extract registry audit advisory IDs/package/range/fix from npm/pnpm JSON | P05-CI-02 | +| [compose.portless.override.yaml](compose.portless.override.yaml) | CI-only override to clear inherited P02 proxy host port publishing; pending CI acceptance | P05-CI-02 post-run correction | diff --git a/tests/ci/README.md b/tests/ci/README.md index fd2e869..c4bc422 100644 --- a/tests/ci/README.md +++ b/tests/ci/README.md @@ -6,6 +6,7 @@ This folder contains **CI-only** source/lockfile checks and OIDC discovery smoke - `oidc_discovery.py` checks ZITADEL readiness, OIDC discovery, JWKS and fail-closed issuer/JWKS negative fixtures on the **disposable** Docker network. It does NOT log in a user or check an authenticated callback. - `account_negative.py` checks that an anonymous Account Portal call returns 401 and that a protected page redirects to `/signin`. It does NOT create a test user or prove real login. - `advisory_triage.py` summarizes available npm/pnpm registry advisory JSON with IDs, ranges and fixes, without changing dependency versions. +- `compose.portless.override.yaml` is **CI-only**, adds `ports: !reset []` to clear P02's inherited Traefik host mapping. Run #83 failed because host 8080 was occupied; this post-run source correction is **not CI-verified**. Use both Compose files together and assert `proxy.ports` absent before startup. P02 dev Compose is unchanged. No real credentials or production domains are used. Never print bootstrap PATs, admin secrets, session cookies or `.env` contents. Cleanup of disposable volumes is mandatory; never apply `docker compose down -v` to a user's non-CI stack. diff --git a/tests/ci/compose.portless.override.yaml b/tests/ci/compose.portless.override.yaml new file mode 100644 index 0000000..16f1c2a --- /dev/null +++ b/tests/ci/compose.portless.override.yaml @@ -0,0 +1,7 @@ +# P05-CI-02 only: override the P02 developer host port in a shared Gitea runner. +# Docker Compose's documented !reset tag removes inherited proxy.ports. +# CI communicates with proxy:80 over the disposable Docker network instead. +# This DOES NOT change the P02 developer Compose file or deploy anything. +services: + proxy: + ports: !reset []