fix(security): patch Next and OpenTelemetry dependencies with CI gates

This commit is contained in:
Vib Tools committed 2026-11-22 06:08:27 -08:00
1 parent 1a602551ad
commit 752d243ae8
29 files changed
+1138 -9280

No files matched your search

+2 -1
View File
@@ -17,7 +17,8 @@ Snapshot: 2026-11-22, **Gitea P05-CI-03 Run #86 backend-only SUCCESS** on `03fb5
| Mutable profile editing / device sessions / identity deletion | No | N/A | No |
| Global ZITADEL SSO logout | No | N/A | No |
| Subscriptions, payments and SaaS billing | Outside ZitPlane scope | N/A | No |
| Gitea Actions CI verification workflow | Yes, P05 manual dispatch | Run #83 full workflow 3 PASS / 1 FAIL; **Run #86 backend-only SUCCESS**, without rerunning other jobs | Not deployed |
| Gitea Actions CI verification workflow | Yes, P05 manual dispatch | Run #83 Account/Login/Security baseline, Run #86 backend-only SUCCESS; P05-SEC-01 patched dependency workflow pending | Not deployed |
| Dependency Moderate security patch/acceptance | P05-SEC-01 manifest and lockfile candidates; strict independent CI gates | **NOT YET CI VERIFIED**: original 18 Login Moderate records and 1 Account package; glob/minimatch likely unresolved | Not deployed |
| Gitea Actions CI and isolated integration tests | Backend-only workflow; interactive identity E2E remains absent | **Run #86 PASS:** disposable backend OIDC ready/discovery/JWKS, Postgres persistence, cleanup; authenticated user E2E pending | No |
| Coolify production stack, TLS, routing and backups | No | No | No |
| Public `auth.vib.tools/login` URL | Proposed only | No | No |
+1
View File
@@ -10,6 +10,7 @@ Every file listed below is a direct child of `docs/`. Add/remove rows whenever t
| [P05-CI-01.md](P05-CI-01.md) | Gitea Actions manual verification workflow, gates, limitations and real run evidence | P05-CI-01 / Run #81 complete, acceptance blocked |
| [P05-CI-02.md](P05-CI-02.md) | TypeScript remediation, Gitea CI verification, dependency risk and isolation evidence | P05-CI-02 / run #83 done; Docker acceptance blocked |
| [P05-CI-03.md](P05-CI-03.md) | Isolated backend-only Gitea CI procedure, checks and exact run outcomes | P05-CI-03 / Run #86 SUCCESS |
| [P05-SEC-01.md](P05-SEC-01.md) | Source-grounded dependency security patches, advisory blockers and CI verification | P05-SEC-01 / awaiting Gitea CI |
| [SETUP-GUIDE.md](SETUP-GUIDE.md) | Operator/developer prerequisites, configs, activation and safety | DOCS-01 / active; runtime pending |
| [FEATURES-STATUS.md](FEATURES-STATUS.md) | Exact implemented/unavailable/unverified feature matrix | DOCS-01 / active |
| [TROUBLESHOOTING.md](TROUBLESHOOTING.md) | Known blockers and safe diagnosis based on source status | DOCS-01 / active |
+44
View File
@@ -0,0 +1,44 @@
# P05-SEC-01 — Dependency Security Remediation & Acceptance
**Date:** 2026-11-22
**Approved baseline:** `1a602551ad9a791efcc594834f2fa6ce748339ae`
**State:** Source patch prepared; one focused Gitea security CI cycle pending.
## Scope and goals
Reduce verified Moderate advisories from the Gitea Run #83 audit without changing login/authentication logic, user interface, ZITADEL Go backend, Docker Compose, production configuration or real data. The original official Login V2 v4.20.4 **source code** remains byte-for-byte unchanged; only its approved `apps/login/package.json` and workspace lockfile dependency declarations/resolutions are patched.
## Dependency changes
- **Account Portal:** direct `next` pinned `16.4.3 → 16.4.6`, with npm v3 lockfile metadata generated without local application dependency installation or scripts. React, Auth.js, TypeScript and application code unchanged.
- **Official Login V2 workspace:** direct `next` `16.4.3 → 16.4.6`; matching development `@next/eslint-plugin-next` `16.4.3 → 16.4.6`. Existing `@opentelemetry/auto-instrumentations-node` `^0.76.0 → ^0.80.0`, associated `@opentelemetry/sdk-node` `^0.218.0 → ^0.222.0` and `@opentelemetry/api-logs` `^0.218.0 → ^0.222.0` use a compatible SDK/instrumentation release family. PNPM v10.30.3 re-resolved **lockfile metadata only** (no local project node_modules).
- **Lockfile maintenance:** pnpm pruned previously retained unreachable snapshot entries from the originally imported full upstream workspace after resolving the four explicitly imported workspace members. This changes many **lock metadata** lines but does not delete source files, modules, auth code or P02 Compose. Gitea frozen install/build is the required acceptance gate.
## Security advisory disposition before focused CI
**Prior baseline from Run #83:** 18 Moderate Login records and one Moderate Account vulnerable `next` package record. Detailed IDs, direct parent paths, fixed version ranges and current lock resolutions: `project/DEPENDENCY-SECURITY.md`, with the full original live audit in `notes/P05-CI-02.md`.
Next.js seven advisories are mitigated **in source dependency declarations** by `next@16.4.6`; nine previously reported OpenTelemetry records use a coordinated patched SDK/instrumentation family. Neither is claimed resolved until **new registry audit and frozen build pass in CI**.
Two additional Login workspace Moderate advisories are not safely patchable under this scope:
- `GHSA-3g3m-2fjr-6pw4`, `glob@10.5.0`, patched at `14.0.2` or later. Root transitive parents such as `@npmcli/package-json`, `rimraf`, `archiver-utils` still require older glob major.
- `GHSA-g3hv-75wg-m249`, `minimatch@10.2.x`, patched at `11.0.1` or later. Parents include `eslint`, `@eslint/config-array`, `nx` and other tooling. Root PNPM overrides are in **read-only** `auth/ui/v2/pnpm-workspace.yaml`, so a forced major override would violate Scope Lock and require compatibility testing.
These must remain OPEN if confirmed in the current CI report; a moderate gate will **fail rather than silently suppress them**. No `pnpm audit --fix`, `npm audit fix --force` or destructive lockfile workaround is permitted.
## Gitea Actions (manual only)
Use **Actions → ZitPlane P05-SEC-01 Dependency Security Acceptance → Run workflow on main** after the source commit is pushed. Dedicated workflow `.gitea/workflows/p05-security-acceptance.yml` has four independent CI jobs:
1. Account `npm ci`, TypeScript check, Next production build and anonymous API/redirect regression.
2. Login pinned PNPM frozen install, original Nx proto/client/Login standalone build and upstream Vitest regression suite.
3. Account High/Critical audit (fail-closed), machine-readable audit and **zero Moderate/High/Critical** acceptance gate.
4. Login High/Critical audit (fail-closed), machine-readable audit and **zero Moderate/High/Critical** acceptance gate.
Separate build and audit jobs preserve useful evidence even if remaining advisories block security acceptance. CI uses no production secrets/domains and no local PC application test/build.
## Acceptance and boundaries
**Security acceptance requires both dependency audits at zero Moderate/High/Critical, frozen installs and application builds/tests PASS**, with exact evidence and no out-of-scope changes. A nonzero Moderate finding is explicitly a **BLOCKED** gate even when build jobs PASS.
**PENDING REAL CI:** run ID, SHA, individual job results, current vulnerabilities and follow-up needed. Full authenticated OIDC callback, MFA, Admin Console login, global SSO and production deployment are outside this phase. See `notes/P05-SEC-01.md` for pre-change plan/closure log.
+6
View File
@@ -53,6 +53,12 @@ Implement one explicitly approved phase at a time. Keep out-of-scope files, exis
- One focused isolated run after source commit/push, no local test/build/Docker, no repeated Account/Login suites, no real users/secrets or production deployment. Full interactive login/MFA remains a separate phase.
- **Gitea Actions Run #86 SUCCESS** on `03fb58954dec886128a4011b6121754cbcdd79ff`: portless effective config PASS, all four services ready, disposable PostgreSQL marker persisted after restart, ZITADEL ready/OIDC issuer/discovery/JWKS and negative contracts PASS, CI-owned network/containers/volumes cleanup verified PASS. No Account/Login build rerun, no local build/Docker. Full interactive OIDC login/MFA and Moderate dependencies remain outside this phase. Evidence: `notes/P05-CI-03.md`, `docs/P05-CI-03.md`.
## P05-SEC-01 - Dependency Security Remediation (APPROVED 2026-11-22)
- Baseline `1a602551ad9a791efcc594834f2fa6ce748339ae`. Previous Run #83 security: 18 Moderate Login advisory records and 1 Moderate Account vulnerable Next.js package; Run #86 backend-only SUCCESS.
- Narrow approved manifest writes: `users/ui/{package.json,package-lock.json}`, `auth/ui/v2/apps/login/package.json`, root `auth/ui/v2/{package.json,pnpm-lock.yaml}` only if justified; new `.gitea/workflows/p05-security-acceptance.yml`, focused `tests/ci/**`, notes/project/docs and associated README/MINIFEST. **`pnpm-workspace.yaml`, application source, Go backend, developer Compose, production and unrelated files remain read-only.**
- Direct Next.js pinned 16.4.6; Login coordinated OTel auto-instrumentation 0.80.0 / SDK 0.222.0 family, PNPM/npm metadata-only lockfile reconciliation. Root overrides are read-only, so glob14/minimatch11 major transitive remediation remains an explicit blocker if registry audit reproduces it.
- Dedicated manual Gitea CI: independent Account/Login frozen installs and builds/regressions, plus separate fail-closed HIGH+ gates and **zero Moderate/High/Critical** gates. Exactly one run, accurate unresolved audit evidence; no local app build/test/dev server or production deployment. Details: `notes/P05-SEC-01.md`, `docs/P05-SEC-01.md`.
## P05 - Full Integration (proposed, NOT approved)
Shared design system, production-safe Compose topology and verified Login/Account OIDC wiring. No live deployment; separate approval.
+1 -1
View File
@@ -26,4 +26,4 @@
Full update policy is in root [AGENTS.md](../AGENTS.md). A list of available docs is in [MINIFEST.md](MINIFEST.md).
For backend-only isolated runtime verification see [P05-CI-03.md](P05-CI-03.md); for initial full workflow and its limitations see [P05-CI-01.md](P05-CI-01.md). A green backend discovery smoke is not an authenticated user-login result.
For dependency security patches and remaining audit blockers see [P05-SEC-01.md](P05-SEC-01.md). For backend-only isolated runtime verification see [P05-CI-03.md](P05-CI-03.md); for initial full workflow and its limitations see [P05-CI-01.md](P05-CI-01.md). A green backend discovery smoke is not an authenticated user-login result.
+5
View File
@@ -76,3 +76,8 @@ In Gitea `vibtools/ZitPlane` → **Actions** → **ZitPlane P05-CI-03 Backend Ac
**P05-CI-03 verified result:** Gitea [Run #86](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/86) **SUCCESS** on source SHA `03fb589`. It confirmed the portless CI backend configuration, four-service readiness, PostgreSQL marker persistence after restart, ZITADEL OIDC discovery/JWKS and complete CI-owned cleanup. This **does not** mean the developer PC or production Coolify instance is configured, nor does it prove an authenticated user login/MFA. The run did not repeat earlier Account/Login builds. See `docs/P05-CI-03.md` for evidence.
## P05-SEC-01 security acceptance on Gitea (manual only)
On Gitea `vibtools/ZitPlane` open Actions → `ZitPlane P05-SEC-01 Dependency Security Acceptance` → Run workflow on `main` **after** the approved source commit is pushed. Jobs use fresh CI runner containers, immutable committed npm/pnpm locks, and no production identity credentials. Account/official Login V2 reproducible builds and unit/negative regressions run separately from Account and Login registry audits. Audits fail if there is **any** Moderate, High or Critical finding; the script prints exact advisory IDs so an outstanding transitive dependency can be fixed in another explicit Scope Lock. The P02 developer Compose, local Windows PC and production Coolify are not modified. See `docs/P05-SEC-01.md` and `project/DEPENDENCY-SECURITY.md`.
+1 -1
View File
@@ -24,7 +24,7 @@ Include environment (local disposable vs CI vs production), exact phase/commit,
- Prior Account Portal `TS2345` at `src/auth.ts(14,61)` in Gitea Run #81 was fixed by verified JWT subject narrowing; Gitea Run #83 Account Portal typecheck/build **PASS**.
- Previous Alpine backend checkout missed Git; Run #83 verified the fix. Run #83 also exposed an occupied shared-runner host TCP 8080. **Run #86 verified the portless CI Compose overlay**: all four services ready, disposable Postgres restart persistence, ZITADEL ready/OIDC discovery/JWKS and complete CI-only cleanup PASS. This does **not** prove the separate P02 local PC Compose or real user login.
- A green HIGH/CRITICAL advisory audit gate still allows Moderate findings; the P05-CI-02 registry detail report records IDs/package/fix separately, without package upgrades.
- A green HIGH/CRITICAL advisory audit gate still allows Moderate findings. P05-SEC-01 updates only approved Next.js/OTel dependency manifests and lockfiles and adds an independent **zero Moderate/High/Critical** acceptance gate. Potential `glob`/`minimatch` transitive major-version issues remain open until a real registry CI audit proves otherwise; no suppressions or forced compatibility-breaking overrides.
- CI negative access tests do not simulate real login; actual OIDC app registration/authorized login/MFA must receive separate approval.
## Known limitations