fix(security): patch Next and OpenTelemetry dependencies with CI gates
This commit is contained in:
1 parent
1a602551ad
commit
752d243ae8
29 files changed
+1138
-9280
No files matched your search
@@ -12,6 +12,7 @@ This is the **developer-focused implementation history**. `notes/CHANGELOG.md` i
|
||||
| 2026-11-22 | P05-CI-01 | `.gitea/workflows/p05-ci.yml`, `tests/ci/**`, Account npm lock, Login pnpm importer reconciliation and in-scope Alpine Git checkout correction | Run #81 overall FAIL; 2 jobs PASS, 2 FAIL; Login 1219/1219 tests PASS, Account TS2345 and Docker checkout blocked; `notes/P05-CI-01.md` |
|
||||
| 2026-11-22 | P05-CI-02 | Type-safe Auth.js subject narrowing, Account anonymous negative tests, Login regression, structured advisory triage and CI-only portless Docker override | Run #83: 3 PASS/1 FAIL; Docker proxy 8080 collision, cleanup PASS, portless fix unverified; see `notes/P05-CI-02.md` |
|
||||
| 2026-11-22 | P05-CI-03 | Dedicated manual backend-only CI acceptance, guarded disposable Compose, persistence/ready/JWKS probes and owned-state cleanup | **Gitea Run #86 SUCCESS** on `03fb589`; all steps PASS; `notes/P05-CI-03.md` |
|
||||
| 2026-11-22 | P05-SEC-01 | Next.js/OTel minimal security manifest and metadata-only locks; strict Moderate+ audits and build/regression CI; no app/UI source modifications | Source under review, one Gitea CI cycle pending; `notes/P05-SEC-01.md` |
|
||||
|
||||
## Required entry for each future change
|
||||
|
||||
|
||||
@@ -82,3 +82,12 @@ This phase can verify local disposable backend runtime only. It **cannot** certi
|
||||
Gitea manual backend-only [Run #86](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/86), job #184, tested `03fb58954dec886128a4011b6121754cbcdd79ff`; **SUCCESS**. The Git checkout, isolated acceptance and always-run cleanup steps all succeeded. P02 3/3 backend contract tests, combined portless config, four service health, disposable Postgres write/restart/read marker, local ZITADEL readiness, exact issuer metadata, OIDC discovery, nonempty JWKS and malformed-input contract checks each produced real PASS markers. The CI-owned network, containers and named volumes were removed; no host TCP 8080 binding remained. Docker v29.9.3 and Compose v5.7.2 used on the runner.
|
||||
|
||||
This confirms **disposable backend acceptance**, not ZITADEL Console user login, Account Portal positive/authenticated callback, real MFA, global SSO, production routing or Moderate advisory remediation. The original P02 Compose and official source/lock versions remain untouched. No repeated Account/Login build/test jobs ran in P05-CI-03. Runtime outcome recorded in `notes/P05-CI-03.md` and `docs/P05-CI-03.md`; final docs-only commit is not a new tested binary/SHA.
|
||||
|
||||
|
||||
## P05-SEC-01 — Independent frozen-build and strict dependency audit gates
|
||||
|
||||
Manual Gitea-only `.gitea/workflows/p05-security-acceptance.yml` has four independent jobs: Account `npm ci`/TypeScript/Next.js build plus anonymous negative route checks; official Login V2 `pnpm@10.30.3 install --frozen-lockfile`, Nx proto/client/standalone build and upstream Vitest regression; standalone Account production registry audit; standalone Login workspace production registry audit. Independent jobs prevent a remaining Moderate advisory from hiding build/test results.
|
||||
|
||||
Each registry job first runs `npm audit --omit=dev --audit-level=high` or `pnpm audit --prod --audit-level high` under `set -eu` to fail-closed on High/Critical. Then nonmutating JSON is collected, `tests/ci/advisory_triage.py` prints exact IDs/package/range/fix, and `tests/ci/security_advisory_gate.py` requires complete/count-consistent JSON and **zero Moderate/High/Critical**. Any Moderate is an actual failed gate, not a warning disguised as acceptance.
|
||||
|
||||
Only approved manifest and lockfile metadata were patched; original Login/auth/API/UI source, `pnpm-workspace.yaml`, P02 backend, Compose, real credentials and production unchanged. Two transitive glob/minimatch risks may remain because the root PNPM override configuration is outside Scope Lock and those require semver-major upgrades. See `project/DEPENDENCY-SECURITY.md` for the original 18+1 records and exact immediate parents; source state is not proof of advisory resolution until actual Gitea run.
|
||||
@@ -0,0 +1,41 @@
|
||||
# ZitPlane P05-SEC-01 — Dependency Provenance, Vulnerabilities and Exact Patch Records
|
||||
|
||||
**Baseline:** `1a602551ad9a791efcc594834f2fa6ce748339ae`
|
||||
**Reference:** Gitea Run #83 security job #173, 2026-11-22. The source-only regenerated npm/pnpm lockfiles are **not CI acceptance** until the subsequent focused security workflow verifies frozen installs and registry advisory results.
|
||||
|
||||
## Advisory inventory (19 prior reported records)
|
||||
|
||||
`npm audit` reported **one affected Account Next.js package** associated with **seven IDs**, not seven different installed npm packages. `pnpm audit --prod` reported **18 Login Moderate records**, representing 7 Next.js IDs, 8 OpenTelemetry driver instrumentation records under a *single GHSA*, 1 HTTP instrumentation advisory, 1 glob and 1 minimatch. Previous HIGH/CRITICAL counts were zero.
|
||||
|
||||
| ID / Group | Affected package(s) and old pin | Verified immediate dependency parent | Security impact / required patched range | Source resolution, pending CI |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Seven Next.js GHSAs below | Account + Login direct `next@16.4.3` | Each application `package.json` | Information/cross-user cache disclosure/poisoning, SVG bypass, Edge HttpOnly header exposure and cross-client response injection; npm fix `16.4.6` | Both apps pin `next@16.4.6` in approved manifest/lock |
|
||||
| `GHSA-qqmp-wf37-98f9` (8 records) | `@opentelemetry/instrumentation-{pg,mysql2,knex,mysql,mongoose,oracledb,tedious,cassandra-driver}` | `@opentelemetry/auto-instrumentations-node@0.76.0` direct production Login dependency | Database account username exposed as `db.user` in spans. Fixed: pg >=0.73.0; mysql2/mysql/mongoose >=0.67.0; knex >=0.65.0; oracledb >=0.46.0; tedious >=0.40.0; cassandra >=0.66.0 | Coordinated parent `auto-instrumentations-node@0.80.0` + `sdk-node@0.222.0` selects patched minors |
|
||||
| `GHSA-3v2p-hm54-8qcq` | `@opentelemetry/instrumentation-http@0.218.0` | `@opentelemetry/auto-instrumentations-node@0.76.0` | Moderate HTTP instrumentation issue, patched >=0.222.0 | `auto-instrumentations-node@0.80.0` requires `instrumentation-http@^0.222.0` |
|
||||
| `GHSA-3g3m-2fjr-6pw4` | `glob@10.5.0`; old lock also `13.0.6` | Snapshot immediate parents: `@npmcli/map-workspaces@3`, `@npmcli/package-json@5`, `rimraf@5`, `archiver-utils@5`, `unified-engine@11`; old `cacache@20` also referenced glob13 | Aborted glob traversal may continue performing costly filesystem operations, risking availability; patched >=14.0.2 | **OPEN**: major 14 not permitted by parent semver/approved root overrides; current workspace YAML read-only |
|
||||
| `GHSA-g3hv-75wg-m249` | `minimatch@10.2.5/10.2.6`; old lock also v9 | Snapshot immediate parents include `eslint@10.8.1`, `@eslint/config-array@0.23.5`, `@typescript-eslint/typescript-estree@8.67.0`, `nx@22.7.12`, `@netlify/build-info@10.5.1` and `glob@13.0.6` | Potential globparts amplification denial of service, patched >=11.0.1 | **OPEN**: major 11 needs compatible transitive parent update or audited PNPM workspace override, outside exact write scope |
|
||||
|
||||
### Seven GitHub advisory IDs affecting Next.js 16.4.3
|
||||
|
||||
`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`.
|
||||
|
||||
Original audit: Login Next fixed >=16.4.5; Account npm recommends >=16.4.6, so **16.4.6 exact** chosen for both plus matching `@next/eslint-plugin-next` (Login dev only). See https://www.npmjs.com/package/next and original Gitea security logs.
|
||||
|
||||
### Transitive parent and compatibility detail
|
||||
|
||||
This table identifies **immediate parents present in the archived PNPM lock graph**, not a claim that every vulnerable package is loaded at runtime or exploitable over a public request. Actual production reachability remains UNVERIFIED without a separate controlled analysis. PNPM's `--prod` audit flagged these lockfile packages, so they must not be suppressed solely because many parents are dev tools.
|
||||
|
||||
`auth/ui/v2/pnpm-workspace.yaml` already owns other root overrides and is explicitly READ ONLY in this phase. A `pnpm.overrides` entry in root `package.json` would conflict with or be ignored in the presence of workspace-defined overrides on modern PNPM; **no ineffective fake override is added**. Minimatch 11/glob 14 are semver major changes; forcing them without compatibility proof is disallowed.
|
||||
|
||||
### Reproducible lockfile / provenance rules
|
||||
|
||||
- Account npm v3 lock was generated by `npm install --package-lock-only --ignore-scripts --no-audit --no-fund`; **no app install/build/test**.
|
||||
- Login pinned `pnpm@10.30.3` lock was generated by `pnpm install --lockfile-only --ignore-scripts --no-frozen-lockfile`; no project `node_modules`. The four imported PNPM workspace members and prior root overrides are unchanged.
|
||||
- PNPM's lockfile-only regeneration removed prior unreachable snapshots inherited from a much larger official ZITADEL monorepo. Source files/proto/Login UI/auth code are unchanged. Compare exact Git diff: this is **lock resolution metadata**, not removal of application features.
|
||||
- Security acceptance is only the single Gitea workflow run: frozen npm/pnpm installs, locked build/regression and live npm/pnpm advisory results. No blind blanket update, no lockfile hand-edited integrities.
|
||||
|
||||
## Source-level candidate and acceptance
|
||||
|
||||
Expected patched direct candidates: Next.js `16.4.6` both apps; Login `@opentelemetry/auto-instrumentations-node@0.80.0`, `@opentelemetry/sdk-node@0.222.0`, `@opentelemetry/api-logs@0.222.0`. **OPEN candidate blockers:** glob >=14.0.2, minimatch >=11.0.1 require separately approved scoped parent/override changes.
|
||||
|
||||
**CI PENDING:** live audit may expose new or unchanged vulnerabilities; never declare zero Moderate from manifest text alone. The follow-up result record will list all remaining exact IDs, job statuses and a separate narrow remediation plan.
|
||||
@@ -135,3 +135,18 @@ For any approved update:
|
||||
| `docs/P05-CI-03.md`, `notes/P05-CI-03.md` | Public-facing CI procedure and accurate implementation/run evidence |
|
||||
|
||||
P02 dev Compose, core backend helper, Login V2 source, Account Portal and all dependency manifests remain unmodified.
|
||||
|
||||
|
||||
## P05-SEC-01 — Dependency security file ownership
|
||||
|
||||
| Path | Exact authorized behavior |
|
||||
| --- | --- |
|
||||
| `users/ui/package.json` and `users/ui/package-lock.json` | Account Portal direct Next.js 16.4.6 security pin and npm v3 metadata-only lock |
|
||||
| `auth/ui/v2/apps/login/package.json` | Official Login V2 dependency **declaration only**: Next.js/ESLint plugin and coordinated OpenTelemetry SDK/auto instrumentation; original app/auth source untouched |
|
||||
| `auth/ui/v2/pnpm-lock.yaml` | Reproducible PNPM v10.30.3 resolution with pruned unreachable snapshots from former large upstream workspace |
|
||||
| `.gitea/workflows/p05-security-acceptance.yml` | Manual four-job CI: independent Account/Login frozen builds and Account/Login production advisory gates |
|
||||
| `tests/ci/security_advisory_gate.py` | Rejects malformed npm/pnpm JSON or any Moderate/High/Critical audit record; never suppresses or changes packages |
|
||||
| `project/DEPENDENCY-SECURITY.md` | Detailed GHSA/group/parent/versions/patch/risk and CI disposition |
|
||||
| `notes/P05-SEC-01.md`, `docs/P05-SEC-01.md` | Pre-change plan, source patch provenance, actual run results and operator guidance |
|
||||
|
||||
**Read-only:** `auth/ui/v2/pnpm-workspace.yaml`, all `users/ui/src/**`, original Login V2 components/logic, backend/Compose and unrelated monorepo packages.
|
||||
@@ -102,3 +102,10 @@ Workflow service orchestration is in `.gitea/workflows/p05-ci.yml`, not Python.
|
||||
| `backend_cleanup.sh` main | Same | Always-step removes only marked CI project with volumes; verifies no fixed network, matching project containers or volumes persist; no marker => no project teardown |
|
||||
|
||||
The scripts execute in the **Gitea Actions** runner, not on the local developer PC. Real user authentication and MFA are not implemented as CI checks.
|
||||
|
||||
|
||||
## P05-SEC-01 — Security-only CI helper behavior
|
||||
|
||||
`tests/ci/security_advisory_gate.py` owns `main()`: it reads one npm or pnpm production registry audit JSON report, checks for report errors, validates required numeric severity counters and matching npm vulnerable-package or pnpm advisory records, prints the actual counts and **returns a failing CI exit code** if Moderate, High or Critical count is nonzero. Invalid or missing report information is also an error. It does **not** modify package manifests, bypass audit rules or accept a waived advisory. The upstream helper `tests/ci/advisory_triage.py` still displays exact GHSA/package/fix records and remains unchanged.
|
||||
|
||||
Workflow shell commands are written directly under `.gitea/workflows/p05-security-acceptance.yml`. No application runtime function or auth code changed in this phase.
|
||||
@@ -6,6 +6,7 @@
|
||||
| [MINIFEST.md](MINIFEST.md) | Exact direct-child file inventory | DOCS-01 / active |
|
||||
| [ARCHITECTURE.md](ARCHITECTURE.md) | Verified component boundaries, identity flows, future integration boundary | DOCS-01 / active |
|
||||
| [CI-ARCHITECTURE.md](CI-ARCHITECTURE.md) | Gitea runner jobs, dependency reconciliation, disposable infrastructure and remaining auth gates | P05-CI-01 / prepared |
|
||||
| [DEPENDENCY-SECURITY.md](DEPENDENCY-SECURITY.md) | Exact GHSA inventory, transitive parents, minimal patch ranges and CI evidence | P05-SEC-01 / active |
|
||||
| [FILE-MAP.md](FILE-MAP.md) | First-party file + module explanation; upstream source references | DOCS-01 / active |
|
||||
| [FUNCTIONS.md](FUNCTIONS.md) | First-party function/route map, safeguards and responsibilities | DOCS-01 / active |
|
||||
| [FEATURES-AND-PAGES.md](FEATURES-AND-PAGES.md) | Every ZitPlane-owned Account Portal page/API and backend/login capability status | DOCS-01 / active |
|
||||
|
||||
@@ -54,3 +54,12 @@ The runner's published TCP 8080 was already in use, so P02's local-only Traefik
|
||||
## P05-CI-03 backend acceptance — proven in Gitea only
|
||||
|
||||
Run #86 on commit `03fb589` executed a backend-only manual Gitea Actions job and verified the original pinned P02 container images on a disposable Docker v29.9.3 / Compose v5.7.2 runner. The P05 portless CI override removed the developer-only host binding, all four containers came up, PostgreSQL retained a synthetic row across a restart, and ZITADEL ready/issuer/OIDC discovery/JWKS passed. Owned network/containers/volumes were verified removed by the always-run cleanup step. No local PC/docker startup, release or production deployment occurred. Remaining steps before deployment: review/patch 18 Moderate Login findings and 1 Moderate Account `next` package, then disposable authenticated OIDC and Admin Console/MFA tests plus production TLS/Coolify/backup readiness.
|
||||
|
||||
|
||||
## P05-SEC-01 — Frozen dependency security resolution
|
||||
|
||||
- Account: direct `next@16.4.6` and npm v3 lock metadata created with `npm install --package-lock-only --ignore-scripts --no-audit --no-fund`; no local application install/build/test.
|
||||
- Imported Login V2: direct `next@16.4.6`, `@next/eslint-plugin-next@16.4.6`; `@opentelemetry/auto-instrumentations-node@^0.80.0`, `@opentelemetry/sdk-node@^0.222.0`, `@opentelemetry/api-logs@^0.222.0` to align the telemetry release family. PNPM v10.30.3 ran metadata-only `install --lockfile-only --ignore-scripts --no-frozen-lockfile`; no project `node_modules` was created.
|
||||
- The imported PNPM lock previously retained snapshots from an upstream monorepo larger than the 4-member ZitPlane workspace. Regeneration pruned many no-longer-reachable snapshots, with only metadata file changes inside approved scope; root workspace `pnpm-workspace.yaml` and imported code unchanged. The Gitea **frozen install** is the required proof of consistency.
|
||||
- Advisory resolution cannot be claimed merely from versions. `glob@10.5.0` and `minimatch@10.2.x` remain in the lockfile through tooling parents with older major ranges, and the workspace override file is read-only. Their Moderate advisories stay OPEN until proven fixed or separately approved.
|
||||
- Dedicated manual Gitea `p05-security-acceptance.yml` performs Account/Login frozen builds and a strict High/Critical + Moderate gate. Prior P05 backend Run #86 was successful and was **not** deployed.
|
||||
+25
-20
@@ -1,25 +1,25 @@
|
||||
# Source inventory ? all Git-tracked paths
|
||||
|
||||
**Snapshot:** 2026-11-22, P05-CI-03 source and docs based on `4857558`. Dedicated backend-only source commit `03fb589` was **verified PASS** by Gitea Run #86; the subsequent documentation commit is not a new runtime test.
|
||||
**Snapshot:** 2026-11-22, P05-SEC-01 security source on approved baseline `1a60255`; the new security CI run has not yet been executed.
|
||||
|
||||
**Git-tracked files: 724.** Untracked `AI_INSTRUCTIONS.md` and ignored secrets excluded.
|
||||
**Exact Git-tracked paths: 729.** Original upstream source semantics unchanged; untracked `AI_INSTRUCTIONS.md` and ignored local secrets excluded.
|
||||
|
||||
This exact path inventory does not assert every upstream function was inspected. Consult `project/FILE-MAP.md` for first-party roles and `docs/P05-CI-03.md` for acceptance.
|
||||
This is a source locator, not proof of security acceptance. See `project/DEPENDENCY-SECURITY.md` for patch/advisory provenance and `notes/P05-SEC-01.md` for actual CI outcome.
|
||||
|
||||
| Group | Files | Owner/purpose |
|
||||
| Top-level group | Files | Ownership |
|
||||
| --- | ---: | --- |
|
||||
| `(repository root)` | 6 | Root files |
|
||||
| `.gitea` | 6 | Gitea manual CI workflow files |
|
||||
| `auth` | 639 | Official pinned Login V2 source |
|
||||
| `core` | 2 | P02 dev orchestration |
|
||||
| `deployment` | 2 | P02 local Compose |
|
||||
| `docs` | 15 | User/operator guides and phase evidence |
|
||||
| `notes` | 7 | Pre-change plans and phase reports |
|
||||
| `packages` | 1 | First-party package placeholder |
|
||||
| `project` | 10 | Developer file/function/CI mapping |
|
||||
| `(repository root)` | 6 | Git-tracked root |
|
||||
| `.gitea` | 7 | Manual Gitea CI workflows |
|
||||
| `auth` | 639 | Original official Login V2 source plus security-only dependency metadata |
|
||||
| `core` | 2 | Backend dev orchestration |
|
||||
| `deployment` | 2 | Dev-only Compose |
|
||||
| `docs` | 16 | User/operator guides |
|
||||
| `notes` | 8 | Pre-change plans/evidence |
|
||||
| `packages` | 1 | Shared package placeholder |
|
||||
| `project` | 11 | Developer file/functions/security maps |
|
||||
| `scripts` | 1 | Script placeholder |
|
||||
| `tests` | 11 | CI/backend focused contracts |
|
||||
| `users` | 24 | First-party Account Portal |
|
||||
| `tests` | 12 | Focused CI contracts/verification tools |
|
||||
| `users` | 24 | Account Portal/approved manifest and lock |
|
||||
|
||||
## Exact Git-tracked paths
|
||||
|
||||
@@ -32,7 +32,7 @@ This exact path inventory does not assert every upstream function was inspected.
|
||||
- `MINIFEST.md`
|
||||
- `README.md`
|
||||
|
||||
### .gitea ? 6 files
|
||||
### .gitea ? 7 files
|
||||
|
||||
- `.gitea/MINIFEST.md`
|
||||
- `.gitea/README.md`
|
||||
@@ -40,6 +40,7 @@ This exact path inventory does not assert every upstream function was inspected.
|
||||
- `.gitea/workflows/README.md`
|
||||
- `.gitea/workflows/p05-backend-acceptance.yml`
|
||||
- `.gitea/workflows/p05-ci.yml`
|
||||
- `.gitea/workflows/p05-security-acceptance.yml`
|
||||
|
||||
### auth ? 639 files
|
||||
|
||||
@@ -693,7 +694,7 @@ This exact path inventory does not assert every upstream function was inspected.
|
||||
- `deployment/README.md`
|
||||
- `deployment/docker/compose.backend.dev.yaml`
|
||||
|
||||
### docs ? 15 files
|
||||
### docs ? 16 files
|
||||
|
||||
- `docs/ARCHITECTURE.md`
|
||||
- `docs/DEVELOPMENT.md`
|
||||
@@ -705,13 +706,14 @@ This exact path inventory does not assert every upstream function was inspected.
|
||||
- `docs/P05-CI-01.md`
|
||||
- `docs/P05-CI-02.md`
|
||||
- `docs/P05-CI-03.md`
|
||||
- `docs/P05-SEC-01.md`
|
||||
- `docs/PHASES.md`
|
||||
- `docs/README.md`
|
||||
- `docs/SETUP-GUIDE.md`
|
||||
- `docs/TROUBLESHOOTING.md`
|
||||
- `docs/USER-GUIDE.md`
|
||||
|
||||
### notes ? 7 files
|
||||
### notes ? 8 files
|
||||
|
||||
- `notes/CHANGELOG.md`
|
||||
- `notes/DOCS-01.md`
|
||||
@@ -719,17 +721,19 @@ This exact path inventory does not assert every upstream function was inspected.
|
||||
- `notes/P05-CI-01.md`
|
||||
- `notes/P05-CI-02.md`
|
||||
- `notes/P05-CI-03.md`
|
||||
- `notes/P05-SEC-01.md`
|
||||
- `notes/README.md`
|
||||
|
||||
### packages ? 1 files
|
||||
|
||||
- `packages/README.md`
|
||||
|
||||
### project ? 10 files
|
||||
### project ? 11 files
|
||||
|
||||
- `project/ARCHITECTURE.md`
|
||||
- `project/CHANGELOG.md`
|
||||
- `project/CI-ARCHITECTURE.md`
|
||||
- `project/DEPENDENCY-SECURITY.md`
|
||||
- `project/FEATURES-AND-PAGES.md`
|
||||
- `project/FILE-MAP.md`
|
||||
- `project/FUNCTIONS.md`
|
||||
@@ -742,7 +746,7 @@ This exact path inventory does not assert every upstream function was inspected.
|
||||
|
||||
- `scripts/README.md`
|
||||
|
||||
### tests ? 11 files
|
||||
### tests ? 12 files
|
||||
|
||||
- `tests/README.md`
|
||||
- `tests/ci/MINIFEST.md`
|
||||
@@ -753,6 +757,7 @@ This exact path inventory does not assert every upstream function was inspected.
|
||||
- `tests/ci/backend_cleanup.sh`
|
||||
- `tests/ci/compose.portless.override.yaml`
|
||||
- `tests/ci/oidc_discovery.py`
|
||||
- `tests/ci/security_advisory_gate.py`
|
||||
- `tests/ci/source_contract.py`
|
||||
- `tests/test_backend_dev.py`
|
||||
|
||||
|
||||
Reference in new issue
Block a user