docs(audit): align source maps, security boundaries and CI coverage for P05-OIDC-07

This commit is contained in:
victorsteele428 committed 2026-11-23 11:25:25 +00:00
1 parent c476f0cd75
commit fd24d92df0
8 files changed
+43

No files matched your search

+6
View File
@@ -45,3 +45,9 @@
P01 folder foundation committed. P02 local Compose source completed (prior 3/3 static tests; no Docker). P03 source import integrity audited (638/638 Git blobs), but no build. P04 Account Portal scope audit passed; no dependency install, lockfile, TypeScript build, E2E or CI run. All runtime behavior remains **unverified**.
See `docs/PHASES.md`, `docs/P02-EVIDENCE.md`, `docs/P03-SOURCE-IMPORT.md` and `docs/P04-ACCOUNT-PORTAL.md` for exact historical evidence.
## P05-OIDC-07 — proposed production trust-boundary topology, NOT deployed
- Public **issuer** `https://auth.vib.tools` (proposed only): one TLS-terminating trusted ingress; `/ui/v2/login/**` → imported Login V2 private 3000, all other ZITADEL API/discovery and `/ui/console/**` → official Go private 8080 via **h2c** for gRPC/gRPC-Web; static exact Host/forwarded-header allowlist, no direct host backend/DB ports.
- Independent relying-party `https://account.vib.tools` (proposed only): separate HTTPS ingress to Auth.js Account, exact registered confidential Web-client callback `https://account.vib.tools/api/auth/callback/zitadel`. Keep user sessions/cookies host-scoped, protected APIs/no-store and issuer/client/subject validation.
- Security/operations boundaries: dedicated `IAM_LOGIN_CLIENT` service identity separate from break-glass `IAM_OWNER`; exactly 32-byte ZITADEL master key protected with separately encrypted Postgres backups/restores; safe Login V2 Console cutover/rollback; digest-locked image provenance and monitoring. Existing `deployment/docker/compose.backend.dev.yaml` remains localhost HTTP/dev only; no real production domains/DNS/certificates/secrets were read or changed. See `notes/P05-OIDC-07.md`, `docs/P05-OIDC-07.md`.
+4
View File
@@ -180,3 +180,7 @@ New `.gitea/workflows/p05-custom-login-acceptance.yml` on a Docker-capable runne
## P05-OIDC-06-A01 — terminal single-run custom source acceptance
Source SHA `7d6b6d0704b9e39bcb6e74257dadf0b64a19fc0f` changed only the `tests/ci/login_image/build.sh` temporary copied entrypoint mode gate. Existing `.gitea/workflows/p05-custom-login-acceptance.yml`, CI Compose overlay, `tests/ci/oidc_e2e/run.sh`, Chromium/provision/cleanup and upstream sources unchanged in A01. Exactly one manual [Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) / job #214 **COMPLETED SUCCESS**, all 5 job steps success. Frozen PNPM/NX/Next standalone build, copy `644→755`, final image default-user executable test, custom image ID matching actual container, private issuer/forwarder/4 services, official disposable credentials, full Chromium Login V2 Auth.js/negative/logout and both cleanups PASS. No runner workflow or production change. Optional Python fallback and diagnostic negative branches NOT EXECUTED; real HTTPS/domain/MFA/SSO are outside CI scope.
## P05-OIDC-07 — acceptance gate gap and next dry-run proposal
This phase dispatched **no new CI**. Earlier manual Run #99 [SUCCESS](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) on `7d6b6d0704b9e39bcb6e74257dadf0b64a19fc0f` verified authentic custom-source Login OIDC and both cleanup systems, not production network/security/operations. **No existing workflow** is accepted as a production TLS/issuer/secret/backup contract validator. Propose independently approved `P05-OIDC-08` with *new only* manual `.gitea/workflows/p05-production-contract-dry-run.yml`, synthetic `deployment/production-contract/{README.md,MINIFEST.md,compose.ci.yaml,routing-policy.json}` and `tests/ci/production_contract/{README.md,MINIFEST.md,validate.py}`: static schema/Compose config (no `up`), exact positive + negative allowlist and secret-reference checks, zero external services, one CI run and no registry/deploy. Existing workflows and source remain strictly read-only. See `notes/P05-OIDC-07.md`.
+4
View File
@@ -87,3 +87,7 @@ This phase **does not modify** `auth/ui/v2/pnpm-workspace.yaml`, `pnpm-lock.yaml
## P05-SEC-02-A01 definitive dependency-security acceptance — verified
[Run #89](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/89) verified the patched seven parent-scoped `glob@14.0.6`/`minimatch@11.0.9` graph on tested SHA `ff4c58ed861474061c8f045be3a9f0752caf6ca0`: corrected selector/lock contract PASS, `pnpm@10.30.3 install --frozen-lockfile` PASS, official Login production standalone build PASS and upstream **1219/1219** unit regressions PASS. The independent production `pnpm audit --prod` registry report was **0 Moderate / 0 High / 0 Critical (also zero Low/Info)**. No package or PNPM lock revisions occurred in this acceptance phase. Previous two Moderate transitive advisories no longer reproduce at this point in time. **Accepted within CI dependency/build/unit scope only**; authenticated OIDC/MFA and production deployment separate.
## P05-OIDC-07 — production artifact supply-chain design only
Historical [Run #89](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/89) reported accepted imported Login frozen build/unit and then-current zero Moderate/High/Critical audit; [Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) built an **ephemeral local-only** Login image using unchanged `node:24-alpine`-tagged upstream Dockerfile and verified runtime real OIDC; there was **no production dependency security refresh, registry publication, SBOM, signature, image digest pin at deployment or reproducible release provenance check**. Production release contract requires immutable digest locking for Go/Login/Account, a current vulnerability scan with explicit severity policy, SBOM and signed artifact/attestation verification, secretless CI logs, no mutable tag drift, and rollback to a previously verified digest. P05-OIDC-07 performed read-only review only.
+4
View File
@@ -58,3 +58,7 @@ Gitea [Run #86](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/86) verified
## P05-OIDC-05 source-vs-acceptance clarification
Run #96 **verified** original prebuilt Login V2 password callback and Account `/signin`, protected account/session/API, anonymous+invalid-callback rejection and local logout. Imported upstream `auth/ui/v2/apps/login/src/app/(login)` has mfa, otp, passkey, u2f, register, password and IdP routes, but their production policies, enrollment/recovery/WebAuthn origin and custom image behavior were **NOT** accepted. Account `/account/security` is informational plus a policy-dependent Console link; no local factor management. Second-app SSO, admin human login, org/tenant permissions and global logout UNVERIFIED. See `notes/P05-OIDC-05.md`.
## P05-OIDC-07 — source features vs proposed production pages
[Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) verified **disposable** imported custom Login V2 username/password, PKCE/state/nonce and Account `/signin`, `/account/**`, protected identity API, anonymous/invalid callback rejects and local logout. **PROPOSED, not live:** `https://auth.vib.tools/ui/v2/login/**`, `https://auth.vib.tools/ui/console/**`, and `https://account.vib.tools/**` with exact Auth.js callback. No real-domain Console human access, MFA/passkey recovery, global logout, or second-app SSO verified. No UI buttons, pages, auth rules, or app deployments changed in P05-OIDC-07. Status and route boundary `docs/P05-OIDC-07.md`.
+9
View File
@@ -202,3 +202,12 @@ Official Login V2 user/auth source, user Account Portal, backend Compose and pro
- `tests/ci/oidc_e2e/run.sh`, `provision.py`, `browser.cjs`, `cleanup.sh`: unchanged A01 accepted opt-in imported custom image and original confidential OIDC browser flow; PASS Run #99.
- `deployment/docker/compose.login-ci.override.yaml`: unchanged temporary Login image replacement only, no public ports.
Source-tested SHA `7d6b6d0704b9e39bcb6e74257dadf0b64a19fc0f`; documentation closure SHA separate. See `notes/P05-OIDC-06-A01.md`.
## P05-OIDC-07 — read-only production config evidence map (no source edit)
- `deployment/docker/compose.backend.dev.yaml`: ZITADEL `EXTERNALDOMAIN=localhost`, `EXTERNALSECURE=false`, `TLS_ENABLED=false`, dev loopback `127.0.0.1:8080:80`, private API h2c and Login routing; root users and mounted Docker socket require independent production hardening. **Never promote to prod**.
- `deployment/docker/compose.login-ci.override.yaml`: temporary run-ID-scoped Login image swap, **not production**.
- `auth/ui/v2/apps/login/{Dockerfile,next.config.mjs,src/proxy.ts,src/lib/server/service-url.ts,src/lib/server/custom-headers.ts}`: non-root upstream image, compiled basePath, CSP/HSTS/server-action origins, forwarded public Host handling; `src/proxy.ts` uses wildcard CORS on proxied paths, requiring an explicit production ingress/CORS review. Read-only.
- `users/ui/src/{auth.ts,lib/env.ts,lib/identity.ts,components/account-shell.tsx}`, `users/ui/next.config.ts`, `.env.example`: production HTTPS origin validator, Auth.js PKCE/state/nonce/session expiry, trusted Host toggle, protected profile, Console link and **portal-local** logout. No actual public ingress or global logout. Read-only.
- `core/backend/zitadel/dev.py`: development `.env` generator/admin bootstrap and local container runner, not production key rotation/secrets/backup.
- `tests/ci/oidc_e2e/**`, `tests/ci/login_image/**` and manual Gitea workflows: Run #99 **disposable HTTP localhost custom Login real OIDC** only, not public HTTPS/cert/production recovery. All paths strictly read-only in this phase. Full contract `notes/P05-OIDC-07.md`.
+8
View File
@@ -157,3 +157,11 @@ Existing `tests/ci/security_advisory_gate.py` remains the independent **live reg
`tests/ci/login_image/build.sh` now validates `$context/.next/standalone/entrypoint.sh` is a regular file and not a symlink, checks first bytes `#!` without printing content, records sanitized numeric `mode UID:GID`, accepts either already-executable `755` or the established source-copy `644` and applies `chmod 0755` **only to the latter temporary copy**. Rejects all unexpected file types/modes and then requires `-x` + exactly `755`. After unchanged Dockerfile build, a no-network/no-secrets `docker run --entrypoint /bin/sh` with default image `nextjs` user validates `/app/entrypoint.sh` is regular, non-symlink, `755`, executable and has a shebang, printing only a fixed PASS marker. Original Git source and Dockerfile untouched.
Run #99 confirmed input `644 UID:GID 0:0`, copied output/image executable and actual custom runtime/Chromium OIDC acceptance, negative and local logout success. Existing run-owned cleanup checks PASS. No provision/browser/Auth.js method changed.
## P05-OIDC-07 — inspected function contract, unchanged source
- `users/ui/src/lib/env.ts::validatedUrl` forbids HTTP for `NODE_ENV=production` and credentials/query/hash in origin URLs. `oidcSettings` requires `AUTH_SECRET` min 32 and `ZITADEL_CLIENT_ID/SECRET` and passes `AUTH_TRUST_HOST`; **does not** provision TLS, register redirects or sanitize ingress headers.
- `users/ui/src/auth.ts` provider/NextAuth callbacks require PKCE/state/nonce and valid provider subject+expiry, JWT maxAge 3600; access-token refresh/global provider logout are **not** implemented.
- `users/ui/src/lib/identity.ts::requireIdentity,zitadelSelfServiceUrl` enforces nonempty subject, produces policy-dependent Console self-service link; `users/ui/src/components/account-shell.tsx::portalLogout` calls local `signOut` only.
- `auth/ui/v2/apps/login/src/lib/server/service-url.ts::getServiceConfig,constructUrl` relies on publicHost/forwarded headers, and `src/proxy.ts::proxy` performs upstream rewrites/CSP/CORS; security at public proxy/Host trust must be verified separately. `src/lib/server/custom-headers.ts::applyCustomHeaders` uses configured headers. No upstream change.
- `core/backend/zitadel/dev.py::create_dev_env,validate_env` generates **development** secrets only (master key 32 chars, login cookie >=32), not production KMS/escrow or rotation. No new functions or behavior in P05-OIDC-07; see `notes/P05-OIDC-07.md`.
+4
View File
@@ -104,3 +104,7 @@ Run #98 on source `fcfa59e826c39b445faa1b5b26c47ce715d8c3d6` built an imported L
The imported upstream `auth/ui/v2/apps/login/scripts/entrypoint.sh` is tracked as Git mode `100644` with unchanged blob `2da2aca45348afeb7480323e02cf98902d479db3`. Its actual standalone build-context copy was **mode `644`, UID:GID `0:0`**, explaining Run #98's OCI direct-execution denial. A01 edits **only** the CI `tests/ci/login_image/build.sh`: verify copied regular file/no symlink/shebang/mode/owner, `chmod 0755` the run-owned temporary copy and verify the resulting image `/app/entrypoint.sh` is executable as the Dockerfile's default `nextjs` user without network/credentials/entrypoint execution. Upstream source/Dockerfile unchanged.
[Gitea Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99), Job #214, exact tested source `7d6b6d0704b9e39bcb6e74257dadf0b64a19fc0f`, **SUCCESS**: local image `zitplane-login-ci:99` ID `sha256:42fba458e25d3186c504ae4532fece489986a18ab5fdcf97e87b052c4866207f`; actual running `zitadel-login` matched image ID; 4 healthy private services, direct Host/issuer, official project/client/test-human, genuine Chromium custom Login V2 password+PKCE/state/nonce/Auth.js callback, protected Account session/API/page, negative checks and logout PASS. Original backend and new image/builder exact-owned cleanup PASS. Separate original-prebuilt Run #96 accepted independently. Production HTTPS/Console/MFA/passkeys/two-app SSO NOT TESTED. See `notes/P05-OIDC-06-A01.md`.
## P05-OIDC-07 — verified disposable CI vs external HTTPS acceptance
Run #99 job #214 SUCCESS on `7d6b6d0704b9e39bcb6e74257dadf0b64a19fc0f` proves real custom-source Login container identity/health and Chromium password→PKCE/state/nonce→Auth.js protected session/API/negative/logout with exact-owned cleanup, under **isolated HTTP localhost**. It does **not** prove trusted TLS termination or certificate chain, public issuer equality, redirect registration, host/header spoof rejection, actual Secure/SameSite cookies, gRPC-Web Console, MFA, user recovery or multi-client SSO. Production contract proposes one `https://auth.vib.tools` issuer with Login prefix → private 3000 and all other API/Console paths → private h2c 8080, plus independent `https://account.vib.tools` Auth.js callback. Strictly fail closed on HTTP wildcard or untrusted forwarded Host. Contract is documentation only, not an untested deployment. See `notes/P05-OIDC-07.md`.
+4
View File
@@ -105,3 +105,7 @@ CI only: official ZITADEL v4.20.4, official Login V2 v4.20.4, PostgreSQL 17.10/T
## P05-OIDC-06-A01 — build artifact and deployment boundary
[Gitea Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) built the unchanged imported Login v4.20.4 PNPM workspace and source-built **temporary local image** using the original Dockerfile; source Git entrypoint `100644` was repaired only in an ephemeral copied CI artifact to `755`. The image ran healthy with original Login V2 confidential bootstrap and real disposable OIDC test credentials, then was destroyed. No registry image publication/digest-locked production release, SBOM/refresh security audit, public HTTPS issuer/domain/DNS/ingress, external secure cookies, production secrets/key escrow/SMTP/Postgres backup+restore, monitoring or rollback is implied by this acceptance. The last production-context audit remains `notes/P05-OIDC-05.md`; next proposed `P05-OIDC-07` is read-only production HTTPS/ingress/security/secret/recovery contract design.
## P05-OIDC-07 — production readiness contracts (no infrastructure changes)
Current deployment material is only a localhost HTTP developer Compose plus a CI-only custom-image override; use neither as a production installer. Source-level Account `ZITADEL_ISSUER` and `AUTH_URL` require HTTPS when `NODE_ENV=production`, and `AUTH_TRUST_HOST` is only valid behind a proxy that sanitizes forwarded Host/Proto. Proposed public hosts `auth.vib.tools` and `account.vib.tools` are **not verified**. Need external trusted certificate, issuer=discovery, exact callback, ZITADEL h2c/HTTP2 Console, strict headers/cookies, private DB/backend ports, least-privileged Login service, separate break-glass IAM_OWNER, exactly 32-byte master key protected with corresponding encrypted DB restore, SMTP and incident/rollback tests. Image tags and successful ephemeral custom image in Run #99 are not signed/digest-locked production artifacts. No secret/key/TLS/DNS/backup/production values accessed or created. Details `notes/P05-OIDC-07.md`.