diff --git a/docs/P05-OIDC-08-A04.md b/docs/P05-OIDC-08-A04.md new file mode 100644 index 0000000..309f3c7 --- /dev/null +++ b/docs/P05-OIDC-08-A04.md @@ -0,0 +1,36 @@ +# P05-OIDC-08-A04 — Full Synthetic Contract Acceptance + +**Acceptance:** [Gitea Run #105](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/105) / Job #221 `COMPLETED / SUCCESS`, tested source `daaa8b259a519ae0290ba28936ef2279b3a9172c`. Exactly one approved manual dry-run; no repeat. Toolchain, checkout, synthetic Compose configuration+Python checks, and `always()` manual-only workflow safety all SUCCESS. + +## Exact normalized service-grant root cause + +Run #104 failed `SERVICE_SECRET_REFS` because the validator expected service grant dictionary `target == source`. Docker Compose normalized **seven** authorized grants into dictionaries whose `target` was the safe canonical **`/run/secrets/`** mount path. Run #105 prints only the safe classes `OBJECT`, `SOURCE_EXPECTED`, `TARGET_CANONICAL_MOUNT` for each entry, never raw grant strings/secret contents. + +The validator accepts only exact six symbolic external secret references, authorized per-service grants, proper canonical targets (or unchanged target names where applicable), default root ownership/read-only mode and strict no-duplicate/no-extra/no-unrecognized-metadata policy. The source's original `synthetic.invalid` images, zero replicas, empty default `resources`/`placement` and internal network are unchanged. + +## Final CI acceptance ledger + +| Gate | Result | +| --- | --- | +| Compose `config --quiet`, source fixture integrity/five zero replicas | **PASS** | +| Canonical secret grants, per-service permissions/expected set | **PASS** | +| HTTPS issuer and exact Account callback (static policy) | **PASS** | +| Login/Console/API h2c routing contract (static policy) | **PASS** | +| Host and forwarded-header trust/TLS policy | **PASS** | +| No public ports, Docker socket, privileged or executable override | **PASS** | +| Original 25 security negative cases | **25/25 PASS** | +| Runtime override negative cases | **4/4 PASS** | +| Replica negative cases | **3/3 PASS** | +| Extra deploy negative cases | **8/8 PASS** | +| Secret-grant negative cases | **8/8 PASS** | +| Inert normalized/default deploy and canonical mount positive fixtures | **PASS** | +| Final synthetic static security contract | **PASS** | +| Manual-only workflow safety | **PASS** | +| Runner task container, two volumes and network cleanup | **PASS — job log** | +| Real HTTPS/TLS/DNS, production ZITADEL/Login, MFA/passkeys, Console or SSO | **NOT EXECUTED / OUT OF SCOPE** | + +**All 48 deliberately malformed synthetic security cases passed exact-error rejection.** This is **source-driven configuration policy acceptance**, not deployment readiness or production security certification. No real secrets were resolved and **no application services were started**. The Gitea CI runner provisioned its own disposable job container/volumes/network and cleaned them; the workflow itself configured only Docker Compose `config` commands. + +The previous imported custom Login V2 [Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) remains separate **disposable real browser PKCE/Auth.js OIDC SUCCESS**; live HTTPS, Console, vault-backed secrets and MFA/SSO remain unverified. + +**Next proposed separately approved phase:** P05-OIDC-09, **read-only, documentation-only production release preflight**, mapping real image/release, secure secret/DB recovery, HTTPS ingress and live acceptance requirements into small exact Scope Locks without any production deployment. Full proposal in [notes/P05-OIDC-08-A04.md](../notes/P05-OIDC-08-A04.md). diff --git a/notes/P05-OIDC-08-A04.md b/notes/P05-OIDC-08-A04.md index 85dc5aa..af3e3f3 100644 --- a/notes/P05-OIDC-08-A04.md +++ b/notes/P05-OIDC-08-A04.md @@ -27,4 +27,61 @@ **Production remains not deployed/unverified:** no real HTTPS, DNS, SSL, production user, issuer, Console, MFA/passkeys/SSO, secure secret vault, master key custody or encrypted backup/restore acceptance in this phase. -**Status before source changes:** Scope Lock note first; exact normalized secret-grant source/target shape still UNKNOWN. +## A04 terminal evidence — one-run full synthetic contract acceptance + +**Scope-first note SHA:** `64d8c0830e5dac5417db2c8de2363b1d472f11c4`; this document was committed before any code modification. **Only source modified:** `tests/ci/production_contract/validate.py`. Source-tested Git SHA `daaa8b259a519ae0290ba28936ef2279b3a9172c`. Unchanged original `deployment/production-contract/compose.ci.yaml` pinned Git blob `930c0b0fbfb518555436acd6f0b4bb3bdd421937`; original policy/workflow/auth/Account/backend/deployment source strictly read-only. Pre-run source/security/diff audit PASS (exact scope note and one source file, no unauthorized path). **No local app tests/build or live DNS/TLS/secret inspection.** + +**Exactly ONE approved manual CI:** [Gitea Run #105](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/105) / Job #221 `COMPLETED / SUCCESS`, branch `main`, tested SHA `daaa8b259a519ae0290ba28936ef2279b3a9172c`, started 2026-11-23T16:36:21Z, completed 16:36:38Z. Step #0 Alpine CI tooling **SUCCESS**, #1 checkout **SUCCESS**, #2 only static Compose config and Python normalized security validator **SUCCESS**, #3 `always()` manual-only/no Docker resource action configuration check **SUCCESS**. **No rerun** and no source edit after CI. + +### Exact verified RCA + +Seven normalized symbolic service secret grants (two for `zitadel-api`, two for `zitadel-login`, two for `account`, one for `postgres`; `ingress-policy` has none) were emitted as **object** entries using their approved symbolic source references and the canonical **`/run/secrets/` mount target**. The old `service_secret_refs()` demanded `target == source`, creating a false positive. Run #105 emitted **seven** `*_ITEM_*_OBJECT`, `*_TARGET_CANONICAL_MOUNT`, `*_SOURCE_EXPECTED` markers; no `*_SOURCE_UNKNOWN` / `*_TARGET_UNEXPECTED` / `*_UNKNOWN_METADATA_PRESENT` diagnostic markers. The corrected validation only allows exact same-name or canonical target mapping, root-owned/read-only `uid/gid/mode` if present, exact approved references by service irrespective of normalization order, and **explicitly rejects duplicates, unknown grant fields, wrong targets, unsafe owners/modes and unauthorized extra sources**. No actual secret contents, raw entry values or arbitrary input keys were printed. + +### Terminal acceptance table — PASS/FAIL/NOT EXECUTED + +| Gate | Verified terminal result | +| --- | --- | +| `docker compose config --quiet`, undeployable synthetic source | **PASS** `ZITPLANE_P08_COMPOSE_STATIC_CONFIG_PASS` | +| Exact source fixture immutable SHA and original five `deploy.replicas: 0` | **PASS** `ZITPLANE_P08_SOURCE_ALL_FIVE_REPLICAS_ZERO_PASS` | +| Original Compose runtime inert null `command` and `entrypoint` on five services | **VERIFIED** ten known-field/null diagnostic markers | +| Private zero replica, inert normalized `resources: {}` and `placement: {}` | **PASS**, `ZITPLANE_P08_NORMALIZED_DEPLOY_METADATA_POLICY_PASS`, `ZITPLANE_P08_NORMALIZED_ZERO_REPLICA_POLICY_PASS` | +| Exact service secret grant source/target, grant defaults, registry and per-service authorization | **PASS**, `ZITPLANE_P08_NORMALIZED_SECRET_GRANT_POLICY_PASS` | +| Canonical HTTPS design issuer, separate Account origin and exact callback; PKCE, state, nonce policy | **PASS as STATIC POLICY**, `ZITPLANE_P08_CANONICAL_HTTPS_ISSUER_AND_CALLBACK_PASS` | +| Login V2 `/ui/v2/login`, Console `/ui/console`, API h2c and private service routes | **PASS as STATIC POLICY**, `ZITPLANE_P08_LOGIN_CONSOLE_API_H2C_PRIVATE_ROUTING_PASS` | +| Host rejection, Forwarded/header replacement and TLS-required policy | **PASS as STATIC POLICY**, `ZITPLANE_P08_HOST_FORWARDED_HEADER_TLS_POLICY_PASS` | +| No public backend/DB ports, plaintext inline credentials, Docker socket, privileged/unsafe runtime configuration | **PASS as STATIC POLICY**, `ZITPLANE_P08_NO_PUBLIC_PORT_INLINE_SECRET_SOCKET_OR_RUNTIME_PASS` | +| Original 25 malformed security cases | **25/25 PASS**, 25 distinct `ZITPLANE_P08_NEGATIVE_*_REJECTED_PASS` + `ZITPLANE_P08_ALL_25_NEGATIVE_CASES_PASS` | +| Nonempty runtime command/entrypoint/build/config | **4/4 PASS**, `ZITPLANE_P08_ALL_4_RUNTIME_NEGATIVE_CASES_PASS` | +| Nonzero/invalid replica and extra deploy settings | **3/3 PASS**, `ZITPLANE_P08_ALL_3_REPLICA_NEGATIVE_CASES_PASS` | +| Populated/unknown deploy metadata | **8/8 PASS**, `ZITPLANE_P08_ALL_8_DEPLOY_NEGATIVE_CASES_PASS` | +| Missing, duplicate, wrong-service, unknown, wrong target, unexpected metadata/owner/write mode grants | **8/8 PASS**, `ZITPLANE_P08_ALL_8_SECRET_NEGATIVE_CASES_PASS` | +| Positive inert normalized defaults/deploy metadata and canonical secret mount representation | **PASS**, `ZITPLANE_P08_INERT_NORMALIZED_DEFAULTS_ACCEPTED_PASS`, `ZITPLANE_P08_INERT_DEPLOY_METADATA_ACCEPTED_PASS`, `ZITPLANE_P08_CANONICAL_SECRET_MOUNTS_ACCEPTED_PASS` | +| Full synthetic contract static validation | **PASS**, `ZITPLANE_P08_STATIC_DRY_RUN_ACCEPTANCE_PASS` | +| Manual only, no configured Docker resource lifecycle steps | **PASS** `ZITPLANE_P08_MANUAL_ONLY_NO_RESOURCE_ACTIONS_CONFIGURED_PASS` (during validation and `always()` step) | +| CI runner-owned disposable resource cleanup | **PASS from terminal job log**: Gitea runner removed its job task container and two task volumes; job network cleanup logged. Not a Docker-daemon-wide production resource inspection | +| Live production HTTPS/DNS/TLS/issuer, signed release images, production secrets/DB, real MFA/passkeys, Admin Console, multi-app SSO, backup/restore or deployment | **NOT EXECUTED / OUT OF SCOPE** | + +**Verified 48 / 48 intentionally invalid synthetic cases PASS**, each with exact expected error-class rejection (25+4+3+8+8). **No negative case remained unexecuted in this synthetic contract test.** No actual application service startup, no production deployment and no real credentials were used. The workflow's runner created a temporary CI task container by design and cleaned it up: do not misstate this as "no CI containers". + +### A04 terminal decision + +**P05-OIDC-08-A04 ACCEPTED: full synthetic static production configuration security contract PASS** on `daaa8b259a519ae0290ba28936ef2279b3a9172c`. Previous Run #101 runtime-field false positive, #102 replica shape, #103 inert deploy keys and #104 normalized grant path have all been resolved for this fixed synthetic fixture in **this one successful Run #105**. Previously accepted [Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) real disposable imported custom Login V2 browser OIDC SUCCESS is a separate CI acceptance, not evidence of a production site. + +This phase does **NOT** certify deploying this `synthetic.invalid` fixture, public HTTPS certificate validity, current real ZITADEL sessions, production secrets, images, backup/restore or MFA/SSO. Phase-close documentation SHA differs from source-tested `daaa8b259a519ae0290ba28936ef2279b3a9172c`. + +### Remaining blockers and proposed next exact Scope Lock — P05-OIDC-09 (SEPARATE APPROVAL REQUIRED) + +**Title:** Production Release Preflight & Source-Verified Deployment Scope (documentation-only forensic audit). + +**Baseline:** use verified final A04 Gitea main SHA after documentation closure. Accepted source `daaa8b259a519ae0290ba28936ef2279b3a9172c` / [Run #105](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/105), [Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99). + +**Exact write scope:** `notes/P05-OIDC-09.md` (commit Scope Lock FIRST), relevant existing `notes/**`, `docs/**`, `project/**`, necessary associated README/MINIFEST. **No source or workflow edits**. + +**Strict read-only:** all `auth/**`, `users/**`, `core/**`, `deployment/**`, `tests/**`, `.gitea/workflows/**`, package manifests/lockfiles, actual Docker/runner config, cloud providers, domains/DNS/SSL/VPS/Coolify, production credentials/files/secrets, untracked `AI_INSTRUCTIONS.md` and unrelated files. + +**Read-only goals:** inventory and threat-model production release dependencies and blockers from existing source/docs/accepted CI evidence: pinned reproducible source-built ZITADEL/Login/Account image provenance + SBOM/signing/version/advisory evidence; secure vaulted 32-byte master key/PAT/client/auth cookie secret custody, rotation and IAM_OWNER break-glass separation; encrypted PG backup+verified isolated restore/rollback; canonical `https://auth.vib.tools` HTTPS issuer and distinct `https://account.vib.tools`, precise Auth.js callback/cookies, trusted edge Host/Forwarded and API/Console h2c routing; private networking and TLS termination; first-admin Console/MFA/passkey recovery; deterministic post-deploy live OIDC and multi-app SSO acceptance; operator stop conditions, non-destructive rollback and exact further independent phase Scope Locks. Mark **SOURCE VERIFIED vs CI VERIFIED vs LIVE NOT VERIFIED**, no guess about production availability or actual DNS. Do not retrieve real credentials or run DNS/TLS checks. + +**Evidence:** one focused repo/source security/documentation diff audit and exact inventory; no new CI dispatch, no local test, no image build/pull/publish, no service startup, no production edit, no tag or release. Commit/push notes/project/docs only; final Gitea main SHA verification. Provide next implementation phase order and ready-to-copy exact approval for separately authorized production work. + +**No P05-OIDC-09 execution without new user approval.** +