fix(security): scope glob and minimatch overrides to affected parents

This commit is contained in:
victorsteele428 committed 2026-11-22 14:33:36 +00:00
1 parent 43eee54e7a
commit 66cfed5a8b
25 files changed
+331 -138

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ This is the **developer-focused implementation history**. `notes/CHANGELOG.md` i
| 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 manifests, reproducible locks, dedicated CI and strict Moderate+ gates | Run #87: Account/Login build PASS, Login Vitest 1219/1219, Account audit 0, Login 2 Moderate open; `notes/P05-SEC-01.md` |
| 2026-11-22 | P05-SEC-02 | Seven parent-targeted glob/minimatch patched resolutions, PNPM lockfile metadata-only and manual Login-only CI guard | Run pending; `notes/P05-SEC-02.md`, `project/DEPENDENCY-SECURITY.md` |
## Required entry for each future change
+9
View File
@@ -96,3 +96,12 @@ Only approved manifest and lockfile metadata were patched; original Login/auth/A
## P05-SEC-01 Run #87 terminal job results
Manual [Run #87](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/87) tested `752d243`. Account job #185 PASS; Login job #186 PASS (frozen pnpm, Nx Next 16.4.6 build and 1219 unit cases); Account security job #187 PASS at all levels with 0 findings; Login security job #188 FAIL on **two Moderate** `glob`/`minimatch` advisories (0 High/Critical). The strict `tests/ci/security_advisory_gate.py` did not suppress them, so **overall run FAILURE** is expected and correct. Full source/security acceptance remains blocked pending a separate narrow transitive dependency phase; no repeated run or application source change.
## P05-SEC-02 — focused Login-only CI acceptance mode
Existing manual `.gitea/workflows/p05-security-acceptance.yml` now offers `workflow_dispatch.inputs.login_only` (default false retains the prior full Account/Login jobs). For **this** phase dispatch **`login_only=true`**, which conditionally skips `account` and `security_account` jobs; only `login` and `security_login` should execute. No production secrets or remote identity client.
`login` starts with CI-only `python3 ../../../tests/ci/transitive_override_contract.py` for the exact seven owned parent overrides and no affected glob/minimatch lock versions, then pinned PNPM frozen install, upstream proto/client/Login standalone build and full `vitest --run` regressions. `security_login` uses existing production PNPM HIGH/CRITICAL audit and independent JSON detail + zero Moderate+ gate; **no suppression**. Both jobs must conclude SUCCESS before declaring P05-SEC-02 accepted. The historical Account zero-vulnerability proof is Gitea Run #87, **not retested** in this focused phase.
A single manual run is authorized; Git source commit/push precedes dispatch, and final evidence-only documentation commit/push follows without a second run. Source-only audit and actual runner results are distinct; see `notes/P05-SEC-02.md` and `docs/P05-SEC-02.md`.
+13
View File
@@ -53,3 +53,16 @@ Expected patched direct candidates: Next.js `16.4.6` both apps; Login `@opentele
- Remaining P05-SEC-02 focus: narrow authorized `auth/ui/v2/pnpm-workspace.yaml` overrides or compatible parent dependency upgrades, reproducible pinned lock, exact transitive resolution and fail-closed Gitea frozen/security/build/unit acceptance. No login/auth/UI source changes.
**P05-SEC-01 classification: PATCH IMPLEMENTED AND BUILDS PASS; SECURITY ACCEPTANCE BLOCKED, not a production release.** Final docs-only SHA differs from the tested Run #87 source SHA.
## P05-SEC-02 — exact seven parent-scoped transitive fixes (candidate)
**Approved baseline:** `43eee54e7ad6b647e38491ac4dc28703547cf410`; **prior failed audit:** Run #87, exactly two Moderate Login advisories and zero High/Critical. No Account changes.
The current pnpm lock snapshots contained only two **direct glob10** parent refs (`rimraf@5.0.10`, `archiver-utils@5.0.2`) and five direct **minimatch10** parent refs (`@eslint/config-array@0.23.5`, `@typescript-eslint/typescript-estree@8.67.0`, `eslint@10.8.1`, `nodemon@3.1.14`, `nx@22.7.12`). The inherited `glob@10.5.0` also depended on `minimatch@9.0.9`. The old ranges were respectively `^10.3.7`, `^10.0.0`, `^10.2.4`, `^10.2.2`, `^10.2.5`, `^10.2.1`, and exact `10.2.5`.
Selected exact patch pins `glob@14.0.6` and `minimatch@11.0.9` are **published**, and both support Node 22. `glob@14.0.6` depends on `minimatch@^11.0.5`. `auth/ui/v2/pnpm-workspace.yaml` gets **only those seven parent-scoped replacements**, not a broad global major override; previous seven workspace overrides and the three imported workspace package paths remain unchanged. A pinned `pnpm@10.30.3` **metadata-only** lockfile regeneration showed `glob@14.0.6`, `minimatch@11.0.9` plus unaffected `minimatch@3.1.5/5.1.9` (outside both GHSA ranges). Its delta was just **35 added / 115 removed lock lines** prior to source commit, with **no application `node_modules` created**.
The seven *semver-major transitive* substitutions require runtime compatibility proofs. `tests/ci/transitive_override_contract.py` checks exact selector ownership, absence of vulnerable lock versions, unchanged importer requirements and the seven parent→version resolutions; it is CI-only. Manual Gitea security workflow option `login_only=true` skips previously accepted Account jobs, executes Login frozen install/build/upstream unit suite and a **strict zero Moderate/High/Critical** live production registry audit. Leave original Login auth, Account Portal, backend, deployment and unrelated package manifests read-only. Source presence is not a production-security guarantee.
**Security acceptance:** PENDING the one focused Gitea run. If registry audit or upstream regression fails, document exact blocker rather than suppressing findings or silently changing major versions.
+13
View File
@@ -150,3 +150,16 @@ P02 dev Compose, core backend helper, Login V2 source, Account Portal and all de
| `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.
## P05-SEC-02 — focused transitive dependency file map
| Path | Exact responsibility |
| --- | --- |
| `auth/ui/v2/pnpm-workspace.yaml` | Seven exact **parent-targeted** glob/minimatch major fixes; previous workspace overrides unchanged |
| `auth/ui/v2/pnpm-lock.yaml` | Pinned PNPM v10.30.3 lock metadata, patched transitive versions, original four importers |
| `.gitea/workflows/p05-security-acceptance.yml` | Optional `login_only=true` manual dispatch, no Account rerun; Login install/build/unit and independent production strict security audit |
| `tests/ci/transitive_override_contract.py` | CI checks only seven exact parent overrides; old affected package versions absent; parents resolve patched version |
| `notes/P05-SEC-02.md`, `docs/P05-SEC-02.md` | Pre-edit parent-chain evidence, exact patch and actual run outcome |
Official Login V2 user/auth source, user Account Portal, backend Compose and production infrastructure remain unmodified.
+7
View File
@@ -109,3 +109,10 @@ The scripts execute in the **Gitea Actions** runner, not on the local developer
`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.
## P05-SEC-02 — CI contract helper
`tests/ci/transitive_override_contract.py::main()` reads the existing `auth/ui/v2/pnpm-workspace.yaml` and resolved `pnpm-lock.yaml` (no network or side effects), verifies exactly seven parent-specific override selectors, checks the four required PNPM importers, rejects any known affected glob (>=9 <=14.0.1) or minimatch (>=7 <11.0.1) snapshot, and asserts that all seven parent dependencies resolve to the exact patched version. Failure returns nonzero in CI; it does not hide audit failures or alter dependencies.
Existing `tests/ci/security_advisory_gate.py` remains the independent **live registry report** gate, rejecting malformed reports and any Moderate/High/Critical finding. A clean lockfile alone cannot prove that the live advisory audit passes.
+7
View File
@@ -66,3 +66,10 @@ Run #86 on commit `03fb589` executed a backend-only manual Gitea Actions job and
**P05-SEC-01 Gitea verification result:** Run #87 on `752d243` proved both frozen installs and production builds, and the Login upstream unit suite **1219/1219 PASS**. Account production audit returned 0 vulnerabilities. Login production audit returned **2 Moderate transitive issues** (glob 14.x and minimatch 11.x patch lines require compatible override/parent work) and zero High/Critical. The strict Moderate gate **failed as intended**. Do not interpret the patched manifest/lockfile as full vulnerability clearance; P05-SEC-02 needs a newly approved change to the read-only PNPM workspace overrides.
## P05-SEC-02 — targeted PNPM workspace security patch
Pre-change source and registry metadata identified two direct `glob@10.5.0` parents and five direct `minimatch@10.2.5/10.2.6` parents. The seven *parent-specific* root workspace overrides point to published `glob@14.0.6` and `minimatch@11.0.9` (Node 22 supported). Pinned PNPM `10.30.3 install --lockfile-only --ignore-scripts --no-frozen-lockfile` generated only lock metadata without app installation/build/tests. `glob@14` now depends on patched `minimatch@11`; `minimatch@3/5` are unaffected by the reported GHSA version ranges.
These are **major** dependency migrations underneath older parents, not an upstream source edit. Only a green Gitea Login Nx production build and upstream unit tests, frozen PNPM install and registry audit can certify compatibility and advisory clearance. The existing security workflow has a manual `login_only=true` focused mode; previously accepted Account results remain from Run #87.
+23 -20
View File
@@ -1,27 +1,27 @@
# Source inventory ? all Git-tracked paths
# Git-tracked source inventory ? exact paths
**Snapshot:** 2026-11-22, P05-SEC-01 source and docs on approved baseline `1a60255`; Gitea Run #87 tested source commit `752d243` (3 PASS / 1 FAIL, 2 Moderate transitive advisories still open). Later documentation-only commit not a new CI test.
**Snapshot:** 2026-11-22, P05-SEC-02 source preparation from approved baseline `43eee54`. **The focused Gitea SEC-02 CI has not yet run.**
**Exact Git-tracked paths: 729.** Original upstream source semantics unchanged; untracked `AI_INSTRUCTIONS.md` and ignored local secrets excluded.
**Git-tracked paths: 732.** Untracked `AI_INSTRUCTIONS.md` and ignored secrets excluded.
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.
This is a complete Git path inventory, not verification of interactive OIDC, application behavior or production. See `project/DEPENDENCY-SECURITY.md` and `notes/P05-SEC-02.md`.
| Top-level group | Files | Ownership |
| Group | Paths | Responsibility |
| --- | ---: | --- |
| `(repository root)` | 6 | Git-tracked root |
| `.gitea` | 7 | Manual Gitea CI workflows |
| `auth` | 639 | Original official Login V2 source plus security-only dependency metadata |
| `(repository root)` | 6 | Repository root |
| `.gitea` | 7 | Manual Gitea workflows |
| `auth` | 639 | Official Login V2 source and scoped PNPM 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` | 12 | Focused CI contracts/verification tools |
| `users` | 24 | Account Portal/approved manifest and lock |
| `deployment` | 2 | Developer Compose |
| `docs` | 17 | User/operator guidance |
| `notes` | 9 | Scope and audit evidence |
| `packages` | 1 | First-party placeholder |
| `project` | 11 | Developer function/file/security maps |
| `scripts` | 1 | First-party placeholder |
| `tests` | 13 | Focused CI tooling |
| `users` | 24 | Read-only Account Portal |
## Exact Git-tracked paths
## Exact tracked paths
### (repository root) ? 6 files
@@ -694,7 +694,7 @@ This is a source locator, not proof of security acceptance. See `project/DEPENDE
- `deployment/README.md`
- `deployment/docker/compose.backend.dev.yaml`
### docs ? 16 files
### docs ? 17 files
- `docs/ARCHITECTURE.md`
- `docs/DEVELOPMENT.md`
@@ -707,13 +707,14 @@ This is a source locator, not proof of security acceptance. See `project/DEPENDE
- `docs/P05-CI-02.md`
- `docs/P05-CI-03.md`
- `docs/P05-SEC-01.md`
- `docs/P05-SEC-02.md`
- `docs/PHASES.md`
- `docs/README.md`
- `docs/SETUP-GUIDE.md`
- `docs/TROUBLESHOOTING.md`
- `docs/USER-GUIDE.md`
### notes ? 8 files
### notes ? 9 files
- `notes/CHANGELOG.md`
- `notes/DOCS-01.md`
@@ -722,6 +723,7 @@ This is a source locator, not proof of security acceptance. See `project/DEPENDE
- `notes/P05-CI-02.md`
- `notes/P05-CI-03.md`
- `notes/P05-SEC-01.md`
- `notes/P05-SEC-02.md`
- `notes/README.md`
### packages ? 1 files
@@ -746,7 +748,7 @@ This is a source locator, not proof of security acceptance. See `project/DEPENDE
- `scripts/README.md`
### tests ? 12 files
### tests ? 13 files
- `tests/README.md`
- `tests/ci/MINIFEST.md`
@@ -759,6 +761,7 @@ This is a source locator, not proof of security acceptance. See `project/DEPENDE
- `tests/ci/oidc_discovery.py`
- `tests/ci/security_advisory_gate.py`
- `tests/ci/source_contract.py`
- `tests/ci/transitive_override_contract.py`
- `tests/test_backend_dev.py`
### users ? 24 files