Files
ZitPlane/notes/P05-SEC-02-A01.md

46 lines
7.2 KiB
Markdown

# P05-SEC-02-A01 — Login Build and Security Final Acceptance
**Date:** 2026-11-22
**Approved Gitea main baseline:** `7655dbdcb48c49aab8f3bf97aab8f1867f129531`
**Previous tested SHA:** `66cfed5a8b6bd5845b229c9934695e307f9a0775`, Gitea [Run #88](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/88)
**Phase status:** ACCEPTED/PASS — one focused Gitea Run #89 completed SUCCESS. This pre-change plan was written before implementation; terminal evidence appears below.
## Approved exact scope
- Potential source writes **only on newly reproduced targeted defects**: `tests/ci/transitive_override_contract.py`, `.gitea/workflows/p05-security-acceptance.yml`.
- Routine writes: `notes/**`, `project/**`, relevant `docs/**`, associated README/MINIFEST and root navigation only when required.
- STRICT read-only: `auth/ui/v2/pnpm-workspace.yaml`, `auth/ui/v2/pnpm-lock.yaml`, all package manifests, Login V2 application/auth/UI source, `users/ui/**`, `core/backend/zitadel/**`, `deployment/docker/**`, all production configuration, secrets and unrelated files. Preserve untracked `AI_INSTRUCTIONS.md`.
- No local app installs/builds/tests/dev servers or Docker; no real accounts/secrets, deployment, tags or releases. **Exactly ONE** focused Gitea Actions acceptance run; do not rerun or rewrite source opportunistically.
## Root-cause proof and pre-implementation plan
1. Gitea Run #88 verified Login `pnpm audit --prod`: **0 Moderate, 0 High, 0 Critical** (security job #192 PASS). Both Account jobs intentionally SKIPPED via `login_only=true`; Login build job #190 failed **before** frozen install because the first P05-SEC-02 contract regex matched existing `axios@>=...`, `brace-expansion@>=...`, `esbuild@>=...` version-range overrides as parent selectors. Thus no Login frozen install, Nx production build or upstream Vitest executed in that run. The failed run cannot prove dependency API compatibility.
2. In post-run source commit `7655dbd...`, `tests/ci/transitive_override_contract.py::overridden()` now matches only keys with an explicit trailing `>glob` or `>minimatch` (regex `[^\\"#:]+>(?:glob|minimatch)`), not incidental `>=` in version ranges. Review source only, including both workspace and locked header override definitions, exact seven expected parent selectors, preserved imported Login/client/proto importers and absence of vulnerable package snapshots. Do **not** execute the helper locally: the user specifically deferred tests to Gitea CI.
3. Gitea manual workflow `.gitea/workflows/p05-security-acceptance.yml` already supports `workflow_dispatch.inputs.login_only=true`: Account build and Account security jobs are conditioned to SKIP; only `login` and `security_login` jobs run. Login job: corrected source contract → `pnpm@10.30.3 install --frozen-lockfile` → original proto/client/Login production standalone build → upstream Vitest. Security job: live `pnpm audit --prod`, fail-closed High/Critical and strict zero Moderate/High/Critical gate.
4. **No new application/CI code edit planned** unless a fresh read-only review finds an exact defect. Commit this pre-run scope/evidence plan and synchronize Gitea main, then dispatch exactly ONE focused CI run at the committed SHA. Confirm no unapproved changes and that the two Account jobs are skipped. If either Login job fails, document exact terminal blocker rather than loop/rerun or claim PASS.
5. Document terminal job IDs, tested SHA, frozen install/Nx build/standalone/Vitest count, strict advisory severities and result; sync `notes/project/docs` and manifests, one closure commit, Gitea push and exact remote+local SHA verification. The final docs-only commit is NOT the tested CI SHA.
## Acceptance gates
**FULL PASS** only if on the same tested SHA: exact seven-scoped override contract PASS; `pnpm install --frozen-lockfile` PASS; official Login Nx proto/client and standalone Next build PASS; upstream Login unit suite PASS with actual counts; Login live registry audit **0 Moderate/High/Critical**; Account jobs SKIPPED intentionally; CI run overall SUCCESS and no unrelated source changes. Without these, phase remains BLOCKED.
**CI evidence ledger:** COMPLETED in Gitea Run #89; see terminal evidence below.
## Terminal Gitea Run #89 — accepted 2026-11-22
**One focused run:** [Gitea Run #89](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/89), manual `workflow_dispatch` with `login_only=true`, branch `main`, **tested exact source SHA `ff4c58ed861474061c8f045be3a9f0752caf6ca0`**. Started 2026-11-22 16:30:28 UTC and completed 16:34:54 UTC. Overall `status=completed`, `conclusion=success`. **One run only**; no repeat of earlier Account/backend suites.
| Job | Gitea ID | Final | Actual evidence |
| --- | ---: | --- | --- |
| Account build | #193 | **SKIPPED intentionally** | `login_only=true`; Account had separate Run #87 acceptance |
| Login frozen/install/build/units | #194 | **SUCCESS** | Existing corrected selector parser `ZITPLANE_EXACT_SEVEN_PARENT_OVERRIDES_PASS`; `ZITPLANE_GLOB_MINIMATCH_PATCHED_LOCK_CONTRACT_PASS`. Pinned `pnpm@10.30.3 install --frozen-lockfile` verified `Lockfile is up to date`, installed **1121** packages and emitted `ZITPLANE_SECURITY_LOGIN_FROZEN_INSTALL_PASS`. Original Nx proto/client/Login Next.js 16.4.6 standalone build and artifact check `ZITPLANE_SECURITY_LOGIN_BUILD_PASS`. Unmodified upstream Vitest **84/84 files and 1219/1219 unit tests PASS**, `ZITPLANE_SECURITY_LOGIN_UNIT_PASS` |
| Account production security | #195 | **SKIPPED intentionally** | `login_only=true`; Account production audit previously returned zero vulnerabilities in Run #87 |
| Login production security | #196 | **SUCCESS** | `pnpm audit --prod --audit-level high` gate PASS; live registry `No known vulnerabilities found`; `PNPM_ADVISORY_RECORDS=0`; metadata `info=0, low=0, moderate=0, high=0, critical=0`; `ZITPLANE_PNPM_ZERO_MODERATE_HIGH_CRITICAL_PASS` |
**Final verdict:** **P05-SEC-02-A01 ACCEPTED/PASS**. The source-only corrected CI contract from previous phase now runs successfully in a disposable Gitea runner. The two prior Moderate `glob` / `minimatch` advisories do not reproduce, and exact frozen dependency graph is compatible with the upstream Login production build and 1,219 unit cases. **This does not establish live authenticated OIDC browser callback, MFA, session/cookie production integration, Console human sign-in or production deployment**. Future dependency advisories remain possible; this is a point-in-time audit.
**Scope/security compliance:** Pre-run planning/documentation only (12 files), **zero CI/helper/application source edits** in A01, **zero dependency manifest/lockfile changes** and 0 secrets. Source inventory 734/734 tracked files, all five direct-folder manifests exact. Old unrelated untracked `AI_INSTRUCTIONS.md` left untouched. No local builds/tests/dev server/Docker. One Gitea cycle, no reruns. The final documentation-only closure commit is not the SHA that Run #89 tested.
**Next phase proposed:** `P05-OIDC-01` isolated real user/client **OIDC positive and negative end-to-end acceptance**, requiring separate explicit approval and disposable provisioning. Its scope must preserve protected auth logic, genuine ZITADEL challenge/PCKE/nonce/state semantics and safe resource cleanup; never call source-level metadata checks a completed user login.