Files
ZitPlane/notes/P05-OIDC-03.md
T

6.7 KiB

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. 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.