test(ci): diagnose socat startup and add private Python fallback

This commit is contained in:
Vib Tools committed 2026-11-22 10:08:09 -08:00
1 parent 5f542a6aa3
commit 7b80f411b2
24 files changed
+338 -31

No files matched your search

+1
View File
@@ -17,5 +17,6 @@ This is the chronological **index**. Phase-specific scope/implementation evidenc
| 2026-11-22 | P05-SEC-02-A01 | One-run final acceptance of corrected CI parser and unchanged Login lockfile/seven overrides | **Run #89 SUCCESS** on `ff4c58e`: frozen install, standalone build and upstream 1219/1219 tests PASS; audit 0 Moderate/High/Critical; Account jobs skipped. [Evidence](P05-SEC-02-A01.md) |
| 2026-11-22 | P05-OIDC-01 | CI-only official ZITADEL OIDC project/client/user and Chromium original Login V2/Auth.js acceptance harness with owned cleanup | **Run #90 FAILED**: 4 services healthy, no host ports; private localhost:8080 forwarder not ready, no user/client/browser created; cleanup VERIFIED PASS. [Evidence](P05-OIDC-01.md) |
| 2026-11-22 | P05-OIDC-02 | Prebuilt/digest-verified socat, private proxy/Host/sidecar state probes, status-only readiness | **Run #91 FAILURE**: backend and private Host routing PASS; forwarder exited code 1, no provisioning/browser; owned cleanup PASS. [Evidence](P05-OIDC-02.md) |
| 2026-11-23 | P05-OIDC-03 | Safe socat exit diagnostics and one digest-pinned Python stdlib private TCP fallback within the same disposable Gitea cycle | Exact [pre-edit scope/evidence](P05-OIDC-03.md), CI pending |
Rules: Append new phases or fixes; never silently rewrite a past result. Separate **implemented**, **verified**, **blocked**, and **proposed**. Never log a user secret or personal data.
+1
View File
@@ -13,6 +13,7 @@
| [P05-SEC-02-A01.md](P05-SEC-02-A01.md) | Single-run Login-only final frozen/build/unit/security acceptance, scope lock and evidence | P05-SEC-02-A01 / Run #89 SUCCESS, accepted |
| [P05-OIDC-01.md](P05-OIDC-01.md) | Pre-change real browser OIDC Scope Lock, provision/redirect/session/negative tests and one CI run evidence | P05-OIDC-01 / Run #90 FAILED at forwarder readiness; cleanup PASS; acceptance BLOCKED |
| [P05-OIDC-02.md](P05-OIDC-02.md) | Pre-change loopback-forwarder scope, pinned digest/preflight fix and one real Gitea acceptance cycle | P05-OIDC-02 / Run #91: private proxy PASS; socat exit 1, OIDC BLOCKED, cleanup PASS |
| [P05-OIDC-03.md](P05-OIDC-03.md) | Pre-edit scoped socat exit diagnosis, immutable Python loopback fallback and one real browser CI evidence | P05-OIDC-03 / source prepared, one CI pending |
| [CHANGELOG.md](CHANGELOG.md) | Short append-only chronological phase log and links to detailed reports | DOCS-01 / active |
Update this manifest whenever any direct child file or directory changes. Use **actual source state**; a planned file must be labeled planned, not present.
+43
View File
@@ -0,0 +1,43 @@
# P05-OIDC-03 — Forwarder Startup Diagnosis & Real OIDC Acceptance
**Date:** 2026-11-23 (Asia/Dhaka)
**User-approved exact baseline:** `5f542a6aa376d06ba2c1fd3d46835baae9b8654e`
**Previous tested SHA:** `4831165548feabc2c0a0d39d25c40e0d1bc23bb2`, Gitea [Run #91](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/91).
**Pre-edit plan status:** APPROVED / EXACT SCOPE LOCK / no P05-OIDC-03 source edit at time of this record.
## Run #91 evidence and actual unknown
- One focused Gitea run #91, job #198, overall **FAILURE**.
- Disposable PostgreSQL, ZITADEL API, official Login V2 and Traefik 4/4 healthy **PASS**; zero published host ports **PASS**.
- Private Traefik:80 Host `localhost:8080` HTTP 200 **PASS**; `alpine/socat:1.8.1.3` tag, `socat` entrypoint and pulled sha256 image digest **PASS**.
- Forwarding sidecar immediately `exited`, `ExitCode=1` before forwarded :8080 check **FAIL**. Its stderr was not captured. Exact cause **UNKNOWN**; could be socat CLI/address parser, bind/socket, image runtime or another error. **Do not claim bind failure or any specific errno without observing it**.
- Official project/client/human provisioning, Chromium original Login V2 password, Auth.js PKCE/state/nonce/code callback, authenticated subject/pages, negative tests and logout **NOT EXECUTED**. They were not proven in Runs #90/#91.
- `always()` owned cleanup `ZITPLANE_BACKEND_CLEANUP_VERIFIED_PASS` and `ZITPLANE_OIDC_ALL_RESOURCES_CLEANED_PASS` **PASS**, no CI-owned resources persisted.
## Scope Lock — exact approved writes
1. `tests/ci/oidc_e2e/run.sh` for narrowly scoped forwarding lifecycle, secret-free socat stderr classification, explicit private proxy/Host/sockets, and optionally switching to a vetted immutable official Python TCP forwarder if socat exits or fails health.
2. New `tests/ci/oidc_e2e/forwarder.py` **only because** Run #91 has proved the pinned socat container process exits code 1 despite healthy underlying proxy routing. The implementation must bind IPv4 `127.0.0.1:8080` only and relay bytes to **namespace-local** `127.0.0.1:80`; no auth changes, external requests, secret/cookie/HTTP-body printing or host port publication. Use the official `python:3.12-alpine` image resolved to immutable repo digest at CI runtime (already used by the existing isolated provisioner), and copy only this script into the run-labeled sidecar.
3. `tests/ci/oidc_e2e/provision.py` and `cleanup.sh` **only if an exact new defect is reproduced**. Existing run-owned cleanup and official API security must be preserved.
4. `notes/**`, `project/**`, relevant `docs/**`, associated `README.md`/`MINIFEST.md` and root navigation if needed.
**STRICT read-only:** `core/backend/zitadel/**`, `deployment/docker/**`, `auth/ui/v2/**`, `users/ui/**`, existing `tests/ci/oidc_e2e/browser.cjs` and `browser.sh`, package manifests/locks, unrelated tests or production configs and any secrets. Preserve unrelated untracked `AI_INSTRUCTIONS.md`. No local builds/tests/dev servers/Docker, real users, deployment, tags or releases.
## Implementation plan BEFORE changes
1. Preserve upstream app/auth/Compose and manual existing Gitea workflow unchanged. Inspect Run #91 and read-only source to establish actual prerequisite: original proxy Host route works, socat process exited with code 1; stderr unknown.
2. Within **the single next Gitea cycle**, start one run-labeled socat container with the exact current options and image/digest, check Docker process state and probe private HTTP 200. If exited or unhealthy, collect **only allowlisted error classes** from its startup stderr (e.g. address-in-use, permission, invalid-address/option, binary/runtime) without printing raw logs; record safe state/exit and classifier marker. Remove this run-labeled diagnostic container, then **at most one** deterministic fallback to the official version/digest-resolved `python:3.12-alpine` stdlib TCP forwarder, using the exact same owned container name/label/network namespace; this is not a second Gitea run. If socat works, keep it. No mock IdP or network relaxation.
3. New `forwarder.py` implements bounded async transparent bidirectional TCP relay, exclusive IPv4 loopback bind and fixed secret-free log markers. Start in run-owned proxy namespace, verify container running and private forwarded `/debug/ready` HTTP 200 with exact Host **before** creating the CI secret volume or calling official API. Sidecar stderr diagnostic must never include request or credential contents.
4. Continue existing untouched `provision.py`, original Account Portal/Chromium browser scripts and `always()` strict run-labeled cleanup. No changes to source auth, TLS or security gates. Real authenticated OIDC cannot PASS without actual official user/client and browser callback/session/negative checks.
5. Complete one focused **source/security/manifest/Git diff audit**, document `notes/project/docs`, Git commit, push Gitea main and verify exact remote source SHA.
6. Dispatch **ONE** manual `p05-oidc-acceptance.yml` Gitea CI run. Record actual run/job IDs, tested SHA, forwarder classification, provisioning, browser/negative and cleanup stage markers and terminal status. If a new blocker appears, record **BLOCKED/NOT EXECUTED** for downstream phases, no repeated CI loop or false PASS.
7. Final documentation-only closure diff audit, commit, main push and exact remote/local SHA verification. Automatically supply remaining work, next exact Scope Lock, compact plan and ready-to-copy approval command.
## Technical design and safety
- On socat failure, use one **safe diagnostic classifier**, not raw `docker logs`. The socat diagnostic runs **before any test user/client/secrets are created**; stdout shows only enumerated class and numeric exit code. Unknown logs are classified `UNCLASSIFIED` without their contents.
- Python fallback runs image **`python:3.12-alpine`** selected and verified by `RepoDigests`, then invoked as `python -u /tmp/forwarder.py`; no `pip`, apt/apk install or unpinned `latest`. Original proxy namespace isolation, no published ports and run-owned label/teardown remain mandatory.
- The fallback does NOT intercept, generate, inspect or log HTTP requests/cookies/auth codes: it is an opaque byte relay to Traefik localhost. Bind only 127.0.0.1:8080. Its server launch errors are classified safely by errno/stage; the browser and official API remain untouched.
- Authentication and cleanup gates remain fail-closed and unmodified. No CI success assumption before real completion.
**Acceptance:** proxy/forwarder readiness + official disposable client/human + real original Login V2 password/PKCE/state/nonce/Auth.js callback + actual protected identity/negative/logout + always verified owned cleanup + no unauthorized source changes. MFA/passkeys, production HTTPS and full Admin Console user flow remain outside this phase.