# Dependency security

Every advisory is fixed in the resolved graph or named with its parent chain. Nothing is dismissed.

## Current versions and why

| Area | Now | Decision |
| --- | --- | --- |
| Next.js | 16.4.6, `eslint` 9, direct lint script | Static export stays: `output: "export"`, `dynamic = "force-static"` on the manifest route, `next build --webpack`. No Next server in the packaged path. |
| Electron | 45.2.1, macOS 13 minimum | Packaging must replace the installed Electron bundle before local App acceptance |
| Raster annotations | Fabric 7.4.0 directly, as a transparent layer over the native canvas | Replaces `tui-image-editor` and its vulnerable Fabric 4 chain. Crop and rotate flatten annotations; select, move, resize and text edit stay available before export. |
| React | 18 for root and Web, 19 for CLI | Unchanged by security upgrades |
| Node | `>=22.12.0`, npm `>=10` | Root engines, CI bootstrap and developer setup share the minimum |
| Transitive npm | One root lockfile for `apps/web`, `apps/desktop`, `apps/cli` | Refresh compatible paths; remove unmaintained chains with no fixed release (`tar`, `form-data`, `postcss`, `extract-zip`, legacy HTTP packages) |
| Python | `uv.lock`, a separate workstream | Same inventory, evidence and gate. Intel macOS supports BM25, the optional embedding wheel is unavailable on Intel, macOS arm64 embedding wheels need Python 3.14 or newer. |

## Rules

| Rule | Detail |
| --- | --- |
| Fixed version | The advisory's first patched version or a later compatible stable release, from GitHub advisories and `npm view` |
| Verification | Both `npm audit --json` and the advisory-range inventory. Comma-separated GitHub ranges are semver conjunctions; parse errors fail. Package-absent records are checked too. |
| Never | `npm audit fix --force`, which can pick unrelated majors. Dismissing an alert because a page is static or a dependency is development-only. |
| No fixed release | Trace every parent, remove the chain where possible, otherwise record parent chain, reason and tested alternative |
| Failure | A clean install, audit, typecheck, build or affected test failure blocks completion and is recorded with its command. The old manifest stays in Git until the minimum source change is proven. |
| Evidence | Ignored reports under `reports/content-security/`, with exact advisories, ranges, versions and commands |

## Boundaries

| Boundary | Rule |
| --- | --- |
| Resolution | All through the root lockfile. Nested entries only when a parent requires them. |
| Build | `npm ci --ignore-scripts`, then workspace checks |
| Runtime | Exported Web assets, Electron main and preload, the Python worker serving them. Untrusted input reaches package CLIs and archive extractors only through product validation. |
| Installed App | Package resolution does not update `/Applications/OpenProgram.app`. Acceptance inspects its actual `process.versions.electron`; source checks do not establish it. |

## Gate

```
npm ci --ignore-scripts
npm audit --json                       # zero vulnerabilities, plus range reconciliation
npm run build --workspace apps/web
npm run typecheck --workspace apps/cli
npm test --workspace apps/cli
npm test --workspace apps/web
npm run check:web
npm run check:desktop
npm run check:cli
git diff --check
```

From a clean install. Also manifest and lockfile consistency, a clean worktree, and a report separating existing source failures from dependency-induced ones. The diff holds only manifests, lockfile, necessary compatibility source, this design and the ignored evidence rule.

**References**

- [Next.js 16 upgrade guide](https://nextjs.org/docs/app/guides/upgrading/version-16)
- [Next.js 16.3.5 release](https://github.com/vercel/next.js/releases/tag/v16.3.5)
- [Electron 44 release](https://www.electronjs.org/blog/electron-44-0)
- [Fabric advisory GHSA-hfvx-25r5-qc3w](https://github.com/fabricjs/fabric.js/security/advisories/GHSA-hfvx-25r5-qc3w)
- [Fabric advisory GHSA-w22m-hvvm-xmwx](https://github.com/fabricjs/fabric.js/security/advisories/GHSA-w22m-hvvm-xmwx)

## Implementation status

Versions above are in the manifests and lockfile. Source checks cover static export, direct lint, the desktop surface, and the raster editor's crop, rotate, draw, annotate, save, undo, redo and destroy. Python stays a coordination boundary around `uv.lock`.
