docs(oidc): lock P05-OIDC-10-A01 safe image environment key RCA before source edits

This commit is contained in:
victorsteele428 committed 2026-11-23 18:01:55 +00:00
1 parent 195568a8be
commit 46e2897380
1 file changed
+30
+30
View File
@@ -0,0 +1,30 @@
# P05-OIDC-10-A01 — Safe OCI Environment-Key Boundary RCA & Provenance Acceptance
**Date:** 2026-11-24 Asia/Dhaka.
**Approved baseline:** `195568a8be978304a686c826cdcbf0ab0d36c6a6`, independently verified current Gitea `main`.
**Previous source-tested SHA:** `6ba004808ef47c8856c1a7906faaf7ee807d15a6`.
**Previous [Run #106](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/106) / Job #222:** `COMPLETED FAILURE`: immutable source-tree/PNPM/base pins PASS; 12/12 provenance negatives PASS; pinned frozen Login standalone and temporary OCI build, 0755 entrypoint, linux/amd64 builder index PASS; final `ZITPLANE_P10_FAIL_CLOSED_IMAGE_SECRET_ENV_KEY` FAIL; partial SPDX/unsigned attestation NOT EXECUTED; unchanged owned builder/image/context cleanup PASS and Gitea task cleanup observed. Actual rejected image env key UNKNOWN (the unanchored `PAT` matcher could match common `PATH`, but this is NOT proven until new CI).
## EXACT APPROVED SCOPE LOCK — THIS NOTE MUST BE COMMITTED BEFORE SOURCE EDITS
**SOURCE WRITE ONLY:** `tests/ci/login_image/provenance.py`. Add fixed allowlisted environment-key diagnostics, precisely scoped fail-closed secret/credential-key handling and focused positive/negative in-memory tests. Retain original 12 source/OCI negative cases unchanged and their markers. Do not alter image pins or bypass real credential injection checks.
**DOCUMENTATION WRITE ONLY:** `notes/**`, relevant `project/**`, relevant `docs/**`, associated `tests/ci/login_image/{README.md,MINIFEST.md}`, `.gitea/workflows/{README.md,MINIFEST.md}`, necessary root README/MINIFEST and exact inventory documentation.
**STRICT READ ONLY:** `auth/**`, `users/**`, `core/**`, `deployment/**`, `tests/ci/login_image/{build.sh,cleanup.sh,provenance-lock.json}`, **ALL existing Gitea workflow YAMLs** including `.gitea/workflows/p05-login-provenance.yml`, **ALL other tests/**, package manifests/lockfiles, Gitea runner config, VPS/DNS/SSL/Coolify/Cloudflare/production credentials and infrastructure, unrelated paths. Untracked `AI_INSTRUCTIONS.md` is untouched/uninspected.
**NO:** local app build/test, production deployment, external live DNS/TLS, secrets/users, signing keys, registry push, release/tag, actual production app startup. **EXACTLY ONE** newly approved manual Gitea dispatch of the unchanged existing provenance workflow, after one focused pre-run source/security/diff audit. If failure: do **not** rerun, dispatch a second run, or edit source post-CI. Run-owned cleanup remains mandatory. Keep accepted prior Run #99 real disposable custom Login and Run #105 48/48 synthetic security CI unchanged.
## Read-only RCA and planned strict remediation
- Existing `validate_image()` parses image `Config.Env` list and currently uses **unanchored** `(SECRET|PASSWORD|TOKEN|PAT|MASTERKEY|DATABASE|AUTH_|PRIVATE_KEY)` search on environment *key names*; innocuous `PATH` contains `PAT`. This is a **code-proven collision candidate**, not a proven actual offending key in Run #106, because the original validator emitted only a fail-closed class.
- Restrict data exposure: in the new CI image scan print only **predefined known safe environment key names**, e.g. `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 approved essential benign system keys if independently justified. For any unexpected key only a fixed marker `UNKNOWN_KEY_PRESENT` or `SENSITIVE_KEY_PRESENT`; **never** print arbitrary keys, raw OCI JSON, environment values, credentials, tokens, file paths from unknown inputs or secret contents.
- Key validation must remain **fail-closed**: accept an exact finite set of documented benign OCI image-config environment names and explicitly enforce credential-sensitive segments/boundaries; reject `AUTH_SECRET`, `ZITADEL_MASTERKEY`, `ZITADEL_SERVICE_USER_TOKEN`, `LOGIN_CLIENT_PAT`, DB passwords, private-key/credential-bearing keys, unknown/unexpected keys, duplicate/invalid environment entries, and unsafe image user, entrypoint, labels or platform. Do NOT broaden allowlisting based on unknown key data or allow env-sensitive prefixes. Require production `NODE_ENV=production`.
- Preserve original **12/12** source/OCI negative cases with exact classes and add PATH positive acceptance plus strict sensitive token/PAT/MASTERKEY/DB/PRIVATE_KEY, unknown/duplicate and malformed env rejection fixtures. New diagnostics must not run on arbitrary strings as dynamic marker suffixes.
- Source/lock/CI remain pinned and unaffected: original imported Git source/tree and Node22 Bookworm/Node24 Alpine OCI base indexes are fixed. Never edit upstream Login code or original image builder/workflow.
- After one focused source/security/cumulative diff review, commit tested source and dispatch one Gitea run. Confirm exact real OCI env key **only if an allowlisted safe diagnostic marker is emitted**, final image attestation/partial SPDX files, 12 original and new cases, standalone build, immutable source/images, 0755/nonroot, owned cleanup. Classify each PASS/FAIL/NOT EXECUTED and record exact source SHA. No second CI or source patch.
- Complete `notes/P05-OIDC-10-A01.md` and `docs/P05-OIDC-10-A01.md`, synchronize project/docs/README/MINIFEST and exact tracked inventory, commit and verify final Gitea main SHA. Distinguish CI-tested source SHA from documentation-only SHA.
**Production stop condition remains:** even if CI passes, partial source/base material SPDX and **UNSIGNED** provenance are not a full transitive/OS SBOM, signed registry release or production HTTPS/Console/MFA/SSO acceptance. Production go/no-go remains BLOCKED pending separate phases.
**Status at Scope Lock commit:** note-first only; exact offending runtime env key still UNKNOWN; no source edit or new CI dispatch.