4.3 KiB
P05-CI-02 — Targeted Remediation & CI Acceptance
Date: 2026-11-22
Baseline: 42adaba0044ee5cb86e6e6bcfd4e00e5fe96ad00 (local main = Gitea main)
State: APPROVED / PRE-CHANGE SCOPE LOCK
Previous CI evidence: Gitea Run #81, tested 42b79362c13b9dbb07f85a58ad278742d91b1f5b, overall FAILURE.
Exact approved write scope
users/ui/src/auth.ts— B01 narrow session callback typing only.users/ui/src/types/next-auth.d.ts— only if needed; avoid otherwise..gitea/workflows/p05-ci.yml— CI isolation/verification/triage/cleanup.tests/ci/**— focused CI-only OIDC negative/discovery/production and audit scripts, plus README/MINIFEST.notes/**,project/**, relevantdocs/**, associated.gitea/**/README.mdandMINIFEST.md; rootREADME.md,MINIFEST.mdonly as necessary.
READ ONLY: core/backend/zitadel/dev.py, deployment/docker/compose.backend.dev.yaml, all auth/ui/v2/** original source and lockfile, users/ui/package.json / package-lock.json, portal UI pages/feature logic and all other files. Preserve unrelated untracked AI_INSTRUCTIONS.md.
No local builds, local tests, dev servers, Docker, real credentials/users, production deployments, tags or releases. Source-level preflight/diff is permitted. Only ONE new manually dispatched Gitea CI acceptance cycle; no repeated reruns to chase green checks.
Root-cause evidence (before edits)
- B01 / TS2345: Run #81 job 165,
users/ui/src/auth.ts(14,61)generic NextAuth config callback rejected; downstreamcallbacks.sessionat lines 50–65 returns inferreduser.id: {}instead ofstring. The current ternary usesvalid ? token.zitadelSubject! : ""; the inferredtoken.zitadelSubject!type is not a reliable string despite the booleanvalidexpression. Correct by independently narrowing the JWT subject usingtypeof ... === "string"before constructing the session, and preserve expiry fail-closed. Noas any, disabling strict mode or weakening route guards. - B02 / Docker checkout: Run #81 job 168 failed in
node:22-alpineactions/checkout@v4: Git missing, archive fallbackNot found. Current Giteamainalready has pre-checkoutapk add --no-cache gitat workflow lines 106–110, not yet executed by CI. Current Compose uses fixed local-only network/port; refuse collisions and cleanup ONLY owned disposable project volumes. Verify Postgres volume survives service restart, then readiness, OIDC issuer/discovery/JWKS on disposable network. No edits to Compose or backend helper. - B03 / Moderates: Run #81 job 167 passed HIGH/CRITICAL threshold, but
pnpm audit --prodreported 18 MODERATE findings, without individual package/advisory IDs. Accountnpm auditalso found 1 MODERATE Next.js issue with multiple GHSA IDs. Generate structured advisory inventory in CI using registry data, record package/affected range/available fix; no blind dependency upgrades. - B04 / OIDC:
tests/ci/oidc_discovery.pycurrently checks ready/discovery/JWKS only, not authenticated user callback, session, MFA or admin login. Add robust negative/issuer/JWKS tests, while keeping real login E2E explicitly BLOCKED until separately approved disposable user/client provisioning.
Implementation plan
- Narrow
users/ui/src/auth.tsTypeScript narrowing patch, no auth flow change. Add CI negative contract probes and source contract checks. - Strengthen Gitea job: auth typecheck/build, Login frozen build/unit regression, JSON advisory triage alongside existing HIGH+ gates, disposable Docker preflight plus Postgres persistence/ready/discovery/JWKS verification and always cleanup.
- Ensure job isolation: no shared Docker network/port takeover, no existing project teardown; fail-closed if daemon/capability/isolation unavailable. No real secrets. One CI run, read job logs and exact conclusions.
- Update
project/,docs/,notes/, manifests. Exact scope/security diff audit, Git commit and authorized Giteamainpush, verify final remote/local SHA. Phase acceptance remains BLOCKED if required gates fail; never claim unexecuted E2E PASS.
Verification ledger
NOT STARTED. Record run ID/SHA, exact terminal job statuses, advisory IDs and severity, Docker persistence/cleanup, remaining blockers and final Git SHA only after real evidence is received.