Files
ZitPlane/notes/P05-SEC-01.md
T

48 lines
4.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# P05-SEC-01 — Dependency Security Remediation
**Date:** 2026-11-22
**Approved baseline:** `1a602551ad9a791efcc594834f2fa6ce748339ae` (Gitea `main`)
**Pre-change status:** APPROVED / PLAN LOCKED; source edits not started.
**Prior evidence:** Gitea Run [#83](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/83) security job #173; Run [#86](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/86) disposable backend ACCEPTED.
## Exact Scope Lock
Write only: `users/ui/package.json`, `users/ui/package-lock.json`, `auth/ui/v2/apps/login/package.json`, `auth/ui/v2/package.json`, `auth/ui/v2/pnpm-lock.yaml` only as justified; new `.gitea/workflows/p05-security-acceptance.yml`, `tests/ci/**`, `notes/**`, `project/**`, relevant `docs/**`, CI README/MINIFEST, root README/MINIFEST only if needed.
Read-only: `auth/ui/v2/apps/login/**` other than approved package.json, `auth/ui/v2/pnpm-workspace.yaml`, all `users/ui/src/**`, `core/backend/zitadel/**`, `deployment/docker/**`, upstream Login logic/other packages, secrets, production systems and untracked `AI_INSTRUCTIONS.md`.
**No local application builds/tests/dev servers or Docker.** Metadata-only package lock regeneration to satisfy explicitly approved lockfile reconciliation is permitted without installing project node_modules, using `--package-lock-only --ignore-scripts` and pnpm `--lockfile-only --ignore-scripts`. One Gitea Actions CI acceptance cycle, not a rerun loop.
## Exact prior advisory evidence
**Account:** npm audit reports one `next` package affected by 7 GHSA advisories:
`GHSA-mfr8-8qww-v76h`,
`GHSA-vc7v-qv4w-wrv8`,
`GHSA-7qx7-33qx-rqx2`,
`GHSA-f3mh-rxg3-f5g2`,
`GHSA-pc58-hwjq-p385`,
`GHSA-rhh4-g77r-r9qj`,
`GHSA-vvgp-ww4w-46vf`.
Root source pins `next@16.4.3`; npm registry advisory shows vulnerable 16.0.0–16.4.4 and patch `16.4.6` (same minor release).
**Login workspace:** 18 Moderate **advisory records** (not 18 distinct CVEs or necessarily 18 exposed runtime code paths):
- 8 vulnerable instrumentations under `GHSA-qqmp-wf37-98f9` (DB username recorded in telemetry spans): `@opentelemetry/instrumentation-{pg,mysql2,knex,mysql,mongoose,oracledb,tedious,cassandra-driver}`. Parent `@opentelemetry/auto-instrumentations-node@0.76.0` direct login dependency; root production instrumentation flow must not be modified. Minimum fixes respectively pg 0.73.0; mysql2 0.67.0; knex 0.65.0; mysql 0.67.0; mongoose 0.67.0; oracledb 0.46.0; tedious 0.40.0; cassandra-driver 0.66.0.
- `GHSA-3v2p-hm54-8qcq`: `@opentelemetry/instrumentation-http`, fixed >=0.222.0.
- `GHSA-3g3m-2fjr-6pw4`: `glob`, fixed >=14.0.2; risk of continued filesystem traversal after cancellation.
- `GHSA-g3hv-75wg-m249`: `minimatch`, fixed >=11.0.1; globparts pattern amplification DoS.
- Same 7 Next.js GHSAs as Account for `next@16.4.3`; registry suggests patched >=16.4.5, account audit recommends 16.4.6.
**Prior High/Critical:** 0 in both production audits on Run #83; moderate issues remain OPEN until security CI actually passes.
## Pre-change investigation and implementation plan
1. Inspect current exact importer, pnpm override settings (existing `pnpm-workspace.yaml` READ ONLY), lockfile package versions and dependency parent paths. Compare npm registry metadata and official advisory fixed ranges. Classify direct vs transitive, production reachability and compatibility.
2. Apply justified exact `next@16.4.6` pins in Account and Login app plus aligned `@next/eslint-plugin-next` only if necessary within approved login package.json. Reconcile Account npm lock metadata-only, no package installation or scripts.
3. For 8 OTel packages, OTel HTTP, glob and minimatch, prefer compatible parent release/resolution that satisfies fixed advisory ranges without source change. pnpm override configuration is outside approved `pnpm-workspace.yaml`; if compatible parent/version/lock changes cannot be proven within current write scope, **document precise blockers and defer**, rather than edit excluded file, fabricate resolved status or use broad incompatible overrides.
4. Regenerate narrowly justified pnpm lock metadata using pinned pnpm; verify frozen importer specs, tracked scope, exact patch/security audit, no secrets and original Login V2 auth source unchanged.
5. Add **manual-only** isolated Gitea security acceptance workflow with frozen npm/pnpm installs, fail-closed HIGH/CRITICAL and separate Moderate advisory inventory/gate (any Moderate remaining => FAIL/explicit blocker), Account typecheck/production build and Login V2 Nx proto/client/standalone build plus focused relevant unit suite.
6. Source audit, docs/manifests sync, one scoped commit/push to Gitea main and exact remote SHA verification; **one CI cycle**. Record real run IDs/results and unresolved vulnerabilities, no false PASS. End with documentation/result commit/push and next exact phase lock/approval.
## Phase evidence ledger
**PENDING.** Update with actual modifications and one focused CI run SHA/job conclusions. If Moderate remain, security closure must stay **BLOCKED**, not silently accepted.