From 2119719394b07bf1cb03210f641acf21a1a04a07 Mon Sep 17 00:00:00 2001 From: Md Nurnobi Date: Mon, 23 Nov 2026 17:47:10 +0000 Subject: [PATCH] docs(oidc): record Run 106 OCI build success, env-key gate failure, owned cleanup and next narrow RCA --- docs/P05-OIDC-10.md | 32 ++++++++++++++++++++++++++ notes/P05-OIDC-10.md | 53 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 docs/P05-OIDC-10.md diff --git a/docs/P05-OIDC-10.md b/docs/P05-OIDC-10.md new file mode 100644 index 0000000..064d7e8 --- /dev/null +++ b/docs/P05-OIDC-10.md @@ -0,0 +1,32 @@ +# P05-OIDC-10 — Disposable Imported Login OCI Provenance: Run #106 + +**Terminal result:** [Gitea Run #106](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/106) / Job #222 **COMPLETED FAILURE**, tested source `6ba004808ef47c8856c1a7906faaf7ee807d15a6`. Exactly one newly approved manual CI, no rerun, no source modification after dispatch. Full terminal evidence and proposed next exact Scope Lock: [notes/P05-OIDC-10.md](../notes/P05-OIDC-10.md). + +## Verified versus blocked + +| Area | Final one-run evidence | +| --- | --- | +| Immutable import source/PNPM lock/Dockerfile/entrypoint Git blob IDs | **PASS** | +| Pinned builder `node:22-bookworm@sha256:e13726ca…` and runtime `node:24-alpine@sha256:116b800c…` | **PASS** source + Docker image resolution evidence | +| Fail-closed in-memory negative fixtures | **12/12 PASS** | +| PNPM root frozen `10.30.3` install, 1121 packages, no re-resolution | **PASS** | +| Nested Login build Corepack | Uses its distinct hash-qualified `pnpm@10.28.2`; toolchain distinction observed | +| Proto/client/Next 16.4.6 standalone + Server Actions | **PASS** | +| Upstream Edge instrumentation warning | **OBSERVED**, build still PASS; review compatibility before release | +| Temporary entrypoint `644→755`, no-network OCI executable probe | **PASS** | +| Actual temporary image build / source ID | **PASS**, `sha256:9ddaccf7f6e60e6d72d580de6b285df697d1404cc8f48e5d2719953a4ea69078` | +| Pinned builder OS/architecture/index | **PASS** | +| OCI environment-variable-name safety rule | **FAIL** `ZITPLANE_P10_FAIL_CLOSED_IMAGE_SECRET_ENV_KEY`; actual key UNKNOWN | +| Full image metadata/security attestation | **BLOCKED** by env gate | +| Partial source/base-material SPDX + unsigned provenance files | **NOT GENERATED** | +| Local run-owned builder/image/context cleanup | **PASS** `ZITPLANE_CUSTOM_LOGIN_ALL_BUILD_RESOURCES_CLEANED_PASS` | +| Gitea runner task container/two volumes/network teardown | **PASS** in runner log | +| Signed full SBOM/registry release, production HTTPS, runtime user auth/Console/MFA/SSO | **NOT EXECUTED / OUT OF SCOPE** | + +### Likely false-positive mechanism (NOT yet confirmed) + +The environment-key guard checks the bare unanchored string `PAT` anywhere in an environment **key name**, which also matches the harmless standard `PATH`. Because no key was logged in the failed run, this is only a **plausible** RCA. The safe next P05-OIDC-10-A01 must identify the precise offending key without printing arbitrary environment values, then retain strong token-boundary secret-key checks. Do not globally disable environment secret scanning. + +The source now has `tests/ci/login_image/provenance.py` and `provenance-lock.json`, and the new manual-only `.gitea/workflows/p05-login-provenance.yml`; prior accepted Run #99 and Run #105 workflows remain unchanged. The material SBOM design is intentionally **partial** and **unsigned**; even a green A01 would not provide full OS/transitive-package SBOM, signed registry release, live production readiness or a production deployment. P05-OIDC-09 production GO/NO-GO remains **BLOCKED**. + +**Next separately approved P05-OIDC-10-A01:** only modify the validator `tests/ci/login_image/provenance.py`, add safe fixed-key classification and boundary-focused tests, then re-run unchanged workflow **once on a new SHA**. Full exact Scope Lock in [notes/P05-OIDC-10.md](../notes/P05-OIDC-10.md). No automatic A01 work. diff --git a/notes/P05-OIDC-10.md b/notes/P05-OIDC-10.md index 382df61..06a030f 100644 --- a/notes/P05-OIDC-10.md +++ b/notes/P05-OIDC-10.md @@ -34,4 +34,55 @@ **P05-OIDC-10 does NOT certify production deployment, signed registry image, public DNS/TLS, master key/backup, Console/MFA/passkeys or multi-app SSO.** Next independent Account OCI/production security work requires a new approval. -**Initial status:** this note must be committed FIRST. No source edit/new CI run yet. +## Terminal one-run forensic acceptance — P05-OIDC-10 + +**Scope-first commit:** `539c7d019d6b238e2214afcbfb59423ed7294175` BEFORE source edits. Only the originally approved five phase paths changed before dispatch: `notes/P05-OIDC-10.md`, new `tests/ci/login_image/{provenance.py,provenance-lock.json}`, narrowly opt-in updated `tests/ci/login_image/build.sh`, new `.gitea/workflows/p05-login-provenance.yml`. All imported `auth/**`, Account, core, deployment, existing workflows, existing `cleanup.sh`, package locks/manifests, runner and live infrastructure read-only. Pre-run exact file/security diff check **PASS**, no unauthorized path. + +**Exactly ONE CI dispatch:** [Gitea Run #106](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/106) / Job #222, source `6ba004808ef47c8856c1a7906faaf7ee807d15a6`, 2026-11-23T17:40:18Z through 17:45:16Z. Terminal **COMPLETED / FAILURE**. Steps: #0 tooling **SUCCESS**, #1 immutable checkout `6ba004808ef47c8856c1a7906faaf7ee807d15a6` **SUCCESS**, #2 source pin/12 negative fixtures **SUCCESS**, #3 pinned OCI build + attestation **FAILURE**, #4 `always()` exact owned cleanup **SUCCESS**. **No second run or post-CI source patch.** + +### Terminal gate ledger + +| Exact gate | Verified result | +| --- | --- | +| Approved Git source checkout `6ba004808ef47c8856c1a7906faaf7ee807d15a6` and immutable imported source-tree/PNPM lock/Dockerfile/entrypoint Git object identities | **PASS** `ZITPLANE_P10_SOURCE_TREE_GIT_AND_LOCK_PIN_PASS` | +| Public OCI base index pin in CI job `node:24-alpine@sha256:116b800c…` and source lock builder `node:22-bookworm@sha256:e13726ca…` | **PASS** actual runner/runtime pull and pinned builder source check | +| Git/OCI provenance negative in-memory fixtures | **12/12 PASS** `ZITPLANE_P10_ALL_12_PROVENANCE_NEGATIVES_PASS` | +| Root PNPM lock installation `pnpm@10.30.3` on 4 workspace projects, 1121 packages, resolution skipped | **PASS** `ZITPLANE_CUSTOM_LOGIN_FROZEN_INSTALL_PASS` | +| Nested Login build toolchain | **OBSERVED**: Corepack also fetched nested Login-package hash-qualified `pnpm@10.28.2` during Nx `@zitadel/login:build`; distinct from root `pnpm@10.30.3`. Exact frozen graph unchanged; reconcile future release toolchain evidence, don't claim one version for every invocation | +| Proto generate, JS client build and Next.js 16.4.6 standalone optimized production Login build/Server Actions allowlist | **PASS** `ZITPLANE_CUSTOM_LOGIN_STANDALONE_BUILD_PASS` | +| Upstream Edge instrumentation | **WARNING only**: imported server module imports Node `crypto`/`fs` in Edge compile traces; build still PASS, runtime compatibility requires independent review before release | +| Entry point copied mode `644`, owner `0:0`, temporary copy fixed to `0755` | **PASS** `ZITPLANE_CUSTOM_LOGIN_TEMP_ENTRYPOINT_MODE_FIXED_PASS`, `ZITPLANE_CUSTOM_LOGIN_ENTRYPOINT_COPY_EXECUTABLE_PASS` | +| Original Dockerfile temporary-copy immutable runtime FROM `node:24-alpine@sha256:116b800c…` | **PASS** `ZITPLANE_P10_DISPOSABLE_DOCKERFILE_BASE_DIGEST_PIN_PASS`, Docker daemon recorded exact index digest during OCI build | +| Source-labeled local OCI build | **PASS** `ZITPLANE_CUSTOM_LOGIN_LOCAL_IMAGE_BUILT_PASS`; image ID `sha256:9ddaccf7f6e60e6d72d580de6b285df697d1404cc8f48e5d2719953a4ea69078`, strictly disposable | +| No-network temporary nonroot image entrypoint probe | **PASS** `ZITPLANE_CUSTOM_LOGIN_BUILT_IMAGE_ENTRYPOINT_EXECUTABLE_PASS`; no Login service or real user was started | +| Pinned builder OS/architecture/index match | **PASS** `ZITPLANE_P10_PINNED_BUILDER_OS_ARCH_INDEX_PASS` | +| Final OCI image environment-key policy | **FAIL** `ZITPLANE_P10_FAIL_CLOSED_IMAGE_SECRET_ENV_KEY` — exact rejected env key **NOT LOGGED/UNKNOWN** | +| Final image source-label/entrypoint/nonroot validation | **Partial**: validator traversed earlier checks before env fail but did **not** complete the full image-provenance gate; no `ZITPLANE_P10_IMAGE_ID_NONROOT_ENTRYPOINT_PROVENANCE_PASS` marker | +| `materials.spdx.json` partial source/base-material SBOM and unsigned `provenance.json` | **NOT EXECUTED / NOT EMITTED** — verifier aborted at env policy before file generation; workflow file-presence gate not reached | +| Final workflow `ZITPLANE_P10_NO_REGISTRY_PUBLISH_OR_APPLICATION_SERVICE_CONFIGURED_PASS` marker | **NOT EXECUTED** (after failed build step); **read-only workflow audit** verifies no `docker push`, `docker login`, production service up/registry secrets | +| Existing `cleanup.sh` run-owned builder/image/context exact teardown | **PASS** `ZITPLANE_CUSTOM_LOGIN_ALL_BUILD_RESOURCES_CLEANED_PASS`, `always()` job step SUCCESS | +| Gitea runner ephemeral job container/2 volumes/job network cleanup | **PASS as runner job-log evidence**; independent of local application image cleanup, does not prove Docker base-cache absence | +| Signed/released registry image, full transitive/OS SBOM, runtime real OIDC, TLS/DNS/MFA/Admin Console/multiapp SSO, production deployment | **NOT EXECUTED / OUT OF SCOPE** | + +### Root-cause precision / stop condition + +A *fail-closed* environment-key policy blocked an otherwise successfully built and probe-executable image at `IMAGE_SECRET_ENV_KEY`. The Python code's `denied = re.compile(r"(SECRET|PASSWORD|TOKEN|PAT|MASTERKEY|DATABASE|AUTH_|PRIVATE_KEY)", re.I)` checks **unanchored substrings** in image environment variable **names**. An ordinary OCI `PATH` starts with substring `PAT`, so it is a **strong plausible false positive** (standard Node images contain PATH); however the validator intentionally did not log the exact key, so **the actual failing env key is UNKNOWN**. Do **NOT** assert PATH is confirmed without an allowlisted safe key-type diagnostic in another separately approved run. No env values, credentials or full image-inspect JSON were exposed. + +**P05-OIDC-10 terminal verdict: PARTIAL CI PASS / FULL OCI PROVENANCE ACCEPTANCE FAILED.** Immutable imported source tree, pinned builder and runtime OCI index use, frozen workspace build, temporary entrypoint and local image ID **VERIFIED**, 12 security-negative fixtures **PASS**; final environment-policy, partial SBOM and unsigned provenance artifact gates **BLOCKED / NOT EXECUTED**. No registry push, production services, tag, release, production TLS or secrets. Accepted separate [Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) custom Login disposable real OIDC and [Run #105](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/105) 48/48 static contract remain SUCCESS and unchanged. + +### Proposed separately approved next exact Scope Lock — P05-OIDC-10-A01 + +**Title:** Safe OCI Environment-Key Boundary RCA & Existing Run #106 Provenance Acceptance. + +**Baseline:** final P05-OIDC-10 **documentation closure** Gitea main SHA (verify at closure); tested source `6ba004808ef47c8856c1a7906faaf7ee807d15a6`; prior [Run #106](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/106) / Job #222 **COMPLETED FAILURE**. + +1. **Commit `notes/P05-OIDC-10-A01.md` FIRST**, explicit approved exact Scope Lock before any new source edits. Explain baseline Run #106 and uncertain exact env key; **do not assume PATH**. +2. **SOURCE WRITE ONLY:** `tests/ci/login_image/provenance.py`. Do **NOT** alter `provenance-lock.json`, `build.sh`, `cleanup.sh`, new or old `.gitea/workflows/*.yml`, imported source, Dockerfile, package lock/manifests, runner or any other source. +3. **DOCS WRITE:** `notes/**`, relevant `project/**`, `docs/**`, necessary associated `tests/ci/login_image/{README,MINIFEST}.md`, `.gitea/workflows/{README,MINIFEST}.md` and root README/MINIFEST as needed. All `auth/**`, `users/**`, `core/**`, `deployment/**`, other tests/workflows/manifests/locks, runner/production DNS/VPS/Coolify/SSL/secrets STRICT READ ONLY; untracked `AI_INSTRUCTIONS.md` untouched. +4. **Evidence-first safe diagnosis:** print only fixed allowlisted OCI environment **key names** such as `PATH`, `NODE_VERSION`, `YARN_VERSION`, `NODE_ENV`, `HOSTNAME`, `PORT`, `NODE_OPTIONS`, `SSL_CERT_FILE`, `ZITADEL_TLS_ENABLED`, `OTEL_SERVICE_NAME`, `OTEL_EXPORTER_OTLP_PROTOCOL`, and fixed `UNKNOWN_KEY_PRESENT`/known-sensitive-class flags for others. **Never print values, arbitrary keys, Docker inspect JSON or credentials.** Diagnose actual key flagged by current matcher. +5. If justified, replace overly broad substring matching with **strict token/segment boundaries**, retaining fail-closed detection for `AUTH_SECRET`, `ZITADEL_MASTERKEY`, `ZITADEL_SERVICE_USER_TOKEN`, `LOGIN_CLIENT_PAT`, DB passwords, private keys, unknown secret material, dangerous environment injection. Retain all previous 12 security-negative assertions and add focused innocuous `PATH` acceptance + true-secret positive rejection fixtures with exact expected failure codes. +6. One focused pre-run source/security/diff audit, source commit/push tested SHA, **exactly one separately approved manual** run of **unchanged** `p05-login-provenance.yml` (no rerun Run #106). Check pinned source/OCI digests, frozen PNPM/Next standalone build, entrypoint, nonroot labels/env, 12+ negatives, partial SPDX materials + unsigned attestation, exact owned cleanup and no registry/deployment; log PASS/FAIL/NOT EXECUTED. On failure stop; no second CI/post-run patch. +7. Sync docs/manifests/inventory, exact final cumulative audit and Gitea main SHA. No image publishing, signing keys, actual DNS/TLS/users/secrets, production, release/tag, local app tests, or user-visible data exposure. + +**No A01 execution without new user approval.** +