30 lines
5.2 KiB
Markdown
30 lines
5.2 KiB
Markdown
# P05-OIDC-08-A03 — Safe Extra Deploy Normalization RCA & Complete Static Security Contract Gate
|
|
|
|
**Date:** 2026-11-23 Asia/Dhaka.
|
|
**User-approved baseline:** `b3b1878e03b3d189ae97ce24a87d6d87c6151811` verified against Gitea `main` before changes.
|
|
**Prior real evidence:** [Gitea Run #103](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/103), job #219, terminal FAILURE, tested source `45a2edb854acd98546e60a68482075bc5f742bd2`. `docker compose config --quiet` PASS; all five source and normalized replicas numeric zero PASS; all five normalized `deploy` objects contained additional unnamed fields; strict `DEPLOY_DISABLED` failed before all 25+4+3 negative fixtures; `always()` workflow-safety PASS, CI-task cleanup reported.
|
|
**Earlier real OIDC:** [Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) imported custom Login V2 disposable HTTP localhost real browser OIDC SUCCESS, independent of this static production contract.
|
|
|
|
## EXACT PRE-SOURCE SCOPE LOCK (commit this note FIRST)
|
|
|
|
**SOURCE WRITE EXACT ONE FILE:** `tests/ci/production_contract/validate.py`.
|
|
|
|
**DOCUMENTATION WRITE:** `notes/**`, relevant `project/**`, `docs/**`, required associated `README.md` / `MINIFEST.md` only (including root README if useful). No other files.
|
|
|
|
**STRICT READ ONLY:** `auth/**`, `users/**`, `core/**`, **all `deployment/**`** (including synthetic `compose.ci.yaml` and `routing-policy.json`), **all existing `.gitea/workflows/**`**, `tests/**` except exact validator and necessary related existing README/MINIFEST, all package manifests/lockfiles, runner settings, DNS/VPS/Coolify/Cloudflare/SSL, production secrets and infrastructure, unrelated files and untracked `AI_INSTRUCTIONS.md`.
|
|
|
|
**NO:** local application build/test; any `docker compose up/run/build/pull`, container service startup or registry publishing; production DNS/HTTPS/certificate lookup, real credentials/users/MFA/login, deploy, tag/release; CI rerun loop; post-dispatch source patch. Allowed CI is only current manually dispatched workflow with static Compose config normalization, stdlib Python checks and runner-managed cleanup. No changes to existing CI workflow.
|
|
|
|
## Evidence-first A03 plan and fail-closed guardrails
|
|
|
|
1. **Read-only before changes:** verified source fixture has exactly five `deploy: replicas: 0` declarations and reserved `synthetic.invalid` images; policy has proposed `https://auth.vib.tools` issuer, `https://account.vib.tools` separate Account origin; existing job #219 shows each normalized `deploy.replicas` integer 0 and **unidentified extra `deploy` field(s)**. Exact field name, type, value and semantics are **UNKNOWN** before this A03 run. Do not infer specific keys from A02 logs.
|
|
2. Modify ONLY `validate.py` to report **predefined finite allowlisted** `deploy` field names (e.g. known Docker Compose metadata keys) and only **safe shape categories** (`NULL`, `EMPTY_OBJECT`, `EMPTY_LIST`, `NONEMPTY_OBJECT`, `NONEMPTY_LIST`, `STRING`, `OTHER`); any other keys reported **UNKNOWN_KEY_PRESENT** without printing input names or values. Source must never print secrets, raw Compose JSON, command text, arbitrary key names or actual values.
|
|
3. Gate acceptance of a specifically named **semantically inert default** using source zero-replica proof, normalized exact true integer-zero replicas in all five, and a narrow per-key allowlist for empty/null metadata *only*. Some known Compose keys may be normalization output, but **must be proven by the new one-shot CI**; if unexpected/unsafe populated keys appear, FAIL and stop. No broad relaxations. All deployment-capable populated `mode`, `placement`, `resources`, `restart_policy`, `update_config`, `rollback_config`, nonempty settings, unknown deploy fields and real images remain rejected.
|
|
4. Preserve original **25** security negatives + prior **4** runtime override negatives + existing **3** replica negatives. Add independent new tests that deliberate unsafe extra deployment metadata is rejected by the exact `DEPLOY_DISABLED` rule (distinct from code failing for some unrelated reason). Preserve OIDC/issuer/callback/routes/Host/headers/internal-only network/secrets/no public ports/no Docker socket/privileges fail-closed checks. No changes to `compose.ci.yaml` or JSON policy.
|
|
5. **One focused pre-CI source/security/diff audit**; commit/push exact tested source SHA to `main`, dispatch **exactly ONE** newly approved manual `p05-production-contract-dry-run.yml`. Check static Compose config, normalized deploy shape evidence, full positive and negative assertions, always-run workflow-safety/CI runner cleanup. **If failure** do not patch source or dispatch again; record PASS/FAIL/NOT EXECUTED and propose narrowly scoped next approval.
|
|
6. Sync exact notes/project/docs, manifests/README/source inventory; perform cumulative allowed-path/secret/diff check, commit/push docs and verify remote `main` SHA. Report clearly which SHA was CI-tested and which is later documentation-only.
|
|
|
|
**Production boundaries:** This is synthetic CI-only validation; **not real HTTPS, live DNS, deployed Login/Console, secrets/backup recovery, MFA/passkey or multi-app SSO acceptance**. No production work is authorized.
|
|
|
|
**Initial status:** Scope Lock committed FIRST. Actual normalized extra `deploy` keys/types remain UNKNOWN pending single CI diagnostics; no source change or CI dispatch yet.
|