diff --git a/CHANGELOG.md b/CHANGELOG.md index e57bdfe..ec40765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ Dated release notes, newest first. The same entries are summarised on the product page; this file is the complete list. +## Unreleased + +### Added + +- **JPEG XL export.** The export dialog offers JPEG XL alongside JPEG, PNG, WebP and + 16-bit TIFF, with the quality slider and a lossless switch. Files are 8-bit sRGB, + encoded by libjxl compiled to WebAssembly in the app itself, so the export stays + offline and nothing is uploaded. The codec loads only when a JXL is exported. No + ICC profile or XMP metadata is embedded yet, and 16-bit JXL waits on a float-input + encoder build. + ## 0.5.3.1 — 1 December 2026 Windows and Linux bundles rebuilt. macOS stays at 0.5.1: the app has to be built on diff --git a/README.md b/README.md index bf0391c..6997083 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ with a keyword library and reusable metadata presets. Save the current filters a order as a smart collection. Virtual copies share the master file but keep independent edits; named snapshots preserve alternative looks. -**Export and print.** JPEG, PNG, WebP or uncompressed 16-bit TIFF; quality; resize by +**Export and print.** JPEG, PNG, WebP, JPEG XL (8-bit, lossy or lossless) or uncompressed 16-bit TIFF; quality; resize by long edge or percent; filename template (`{name}`, `{date}`, `{time}`, `{index}`); saved export recipes; output sharpening; watermark; XMP metadata embedded in JPEGs; sRGB, Display P3 or Adobe RGB output with a matching generated ICC profile (JPEG/TIFF); batch diff --git a/SECURITY-AUDIT.md b/SECURITY-AUDIT.md new file mode 100644 index 0000000..314c299 --- /dev/null +++ b/SECURITY-AUDIT.md @@ -0,0 +1,136 @@ +# Security audit + +Date: 1 December 2026 · Version: 0.5.3.1 · Scope: this repository (server, client, +build/release scripts, dependencies). Review was static: dependency scan plus a +targeted read of the server's trust boundaries. No infrastructure, host or +third-party service was tested. + +## Summary + +No critical or high-severity issue was found in code that ships and runs by +default. The production dependency tree has two `high` advisories that come from +one transitive package (`adm-zip` inside `onnxruntime-node`) and are not +reachable through anything this application does. + +Everything else is either a development-only toolchain advisory, a hardening +opportunity, or an operational note. + +| Area | Result | +| --- | --- | +| Production dependencies | 0 critical, 0 moderate, 2 high (one transitive package, not reachable) | +| Development dependencies | 2 critical, 3 high, 3 moderate — dev server and test runner only | +| Authentication and sessions | scrypt with per-user salt, random tokens, HttpOnly/SameSite cookies, rate limiting | +| Authorisation | Every `/api/admin/*` route calls `requireAdmin`; gallery routes are token-scoped | +| Injection | No `eval`, no `new Function`, no `innerHTML`/`dangerouslySetInnerHTML`; SQLite access is entirely prepared statements | +| Path traversal | Static and tether paths are resolved and compared against a root; uploads use generated IDs | +| Secret handling | SMTP and bridge credentials AES-256-GCM encrypted at rest; no secrets in the tree | +| Uploads | Global size cap, content-length checked before reading, quota per account | +| Outbound requests | Immich and dashboard URLs are operator-configured, not user-configured | + +## Dependency findings + +### 1. `adm-zip` — high, transitive (`onnxruntime-node` → `adm-zip`) + +Advisories: crafted ZIP triggers a 4 GB allocation; extraction follows +destination symlinks and can overwrite arbitrary files; uncontrolled memory +allocation via a declared size. + +Reachability here: `onnxruntime-node` declares `adm-zip` for its own archive +handling. Luminary never extracts a ZIP it did not create: the denoise models are +read from local storage, and the only ZIP code in the app writes archives +(`src/lib/zip.ts`) rather than reading them. No route accepts a ZIP. Impact is +therefore latent rather than exploitable. + +Fix: upgrade `onnxruntime-node` 1.23.0 → 1.31.1 (`npm i onnxruntime-node@1.31.1`). +That is the version npm proposes, a non-major bump. Not applied in this pass +because it changes the denoise runtime and needs its own regression run. + +### 2. Development toolchain — 2 critical, 3 high, 3 moderate + +`vitest`/`tinypool`/`@vitest/mocker` (prototype-pollution gadget to RCE, arbitrary +file read via the Vitest UI server), `vite` (path traversal in optimised-deps +`.map` handling, `launch-editor` NTLM hash disclosure), `esbuild` (dev server +request proxying). + +None of these ship: the release bundle is static `dist/` output and the Node +server does not run Vite. They matter only for a machine that runs `npm run dev` +or the Vitest UI while exposed to an untrusted network. Fix by moving to the +current Vite/Vitest majors on a branch, not by a patch bump inside the current +majors. + +`npm audit --omit=dev` is the meaningful gate for releases; add it to +`predeploy` if that gate should be enforced. + +## Verified controls + +- **Password storage**: `scrypt` (`server/auth.mjs`), 32-byte key, per-hash random + salt, compared with `timingSafeEqual`. Non-existent accounts spend the same + scrypt work and return the same message, so the endpoint does not reveal which + addresses are registered. +- **Sessions**: 32-byte random tokens, `HttpOnly`, `SameSite=Lax`, `Secure` when + the request arrived over HTTPS, 30-day lifetime, server-side revocation on logout. +- **Rate limiting**: sign-in is limited per IP and per IP+account (429 with + `Retry-After`), gallery unlock is limited per link. +- **Authorisation**: 26 `requireAdmin` checks cover the admin surface; missing or + disabled accounts are rejected; the desktop local owner is only used when + `LUMINARY_LOCAL=1`. +- **Gallery links**: separate password hash with its own salt, constant-time + compare, unlock cookie random per session and held in memory, so a restart + re-locks the gallery. Share tokens are 18 random bytes. +- **Bridge**: HMAC-SHA256 over the payload, version-tagged, expiry checked, + constant-time signature compare. +- **Path handling**: static requests are resolved then checked with + `path.relative` against `dist`; tether file names go through `basename` and + must match exactly; stored files are addressed by generated IDs. +- **Uploads**: `MAX_UPLOAD` enforced against `content-length` before reading and + again while streaming. +- **Headers**: CSP with `object-src 'none'`, `frame-ancestors 'self'`, + `nosniff`, `SAMEORIGIN`, `same-origin` referrer policy, restrictive + `Permissions-Policy`. No CORS headers are emitted, so browsers cannot read + responses cross-origin. +- **Secrets**: SMTP app password and bridge tokens are sealed with AES-256-GCM + (`server/secrets.mjs`); the key comes from `LUMINARY_SECRET_KEY` or a + `0600` file beside the database. No credentials or API keys are committed. + +## Hardening opportunities (not vulnerabilities) + +1. **CSP includes `'unsafe-eval'`.** It is there for the WebAssembly engines. The + modern token is `'wasm-unsafe-eval'`; keeping the broader one means any future + DOM-XSS can compile and run script. Tighten to `'wasm-unsafe-eval'` and test + LibRaw/JXL/ONNX still initialise. +2. **Server-side request forgery surface.** The Immich base URL and dashboard URL + are operator-supplied and fetched by the server with credentials attached. + An admin can point them at internal services. Acceptable for a self-hosted + tool, but worth blocking loopback/link-local targets by default, or stating + the trust assumption in the docs. +3. **Per-account sign-in limiting is scoped by IP.** A distributed attempt against + one address is not globally throttled; scrypt cost is the only brake. A global + per-account counter would close that. +4. **30-day sessions** with no rotation on privilege change. Revoking sessions on + password change is worth adding. +5. **No HSTS, no built-in TLS.** Correct for a loopback desktop app; for team + installs it depends on a reverse proxy, so document that. +6. **`secret.key` beside the database** protects backups and dumps, not a full + data-directory compromise. `LUMINARY_SECRET_KEY` is the stronger option and + should be recommended for team installs. +7. **Minimum password length is 8** with no breach-list check. Fine; consider 12 + for admin accounts. + +## Release artefact checks + +- The desktop bundles copy `dist/` and production `node_modules/`; no dev + dependencies or test files are included. +- The new JPEG XL encoder is WebAssembly executed in the browser sandbox, loads + only when a JXL export is chosen, makes no network requests, and is Apache-2.0 + (`@jsquash/jxl`, libjxl BSD-3-Clause). No new server-side attack surface. +- JPEG exports re-encode pixels, so camera EXIF is not carried into delivered + files; only the XMP block Luminary writes is added. + +## Recommended order + +1. `onnxruntime-node@1.31.1` with a denoise regression run (clears both production + highs). +2. Tighten CSP to `'wasm-unsafe-eval'` and re-test raw, JXL and denoise loading. +3. Vite/Vitest major upgrade on a branch (clears every dev advisory). +4. Seal the Immich API key if it is not already sealed. +5. Add `npm audit --omit=dev --audit-level=high` to `scripts/predeploy.mjs`. diff --git a/docs/Luminary-User-Guide.pdf b/docs/Luminary-User-Guide.pdf index e81630b..e4cc90a 100644 Binary files a/docs/Luminary-User-Guide.pdf and b/docs/Luminary-User-Guide.pdf differ diff --git a/docs/user-guide/guide.html b/docs/user-guide/guide.html index e2a1b7e..6ff1e97 100644 --- a/docs/user-guide/guide.html +++ b/docs/user-guide/guide.html @@ -255,7 +255,7 @@
| Option | What it does |
|---|---|
| Format | JPEG, PNG, WebP or uncompressed 16-bit TIFF. JPEG and WebP expose quality; PNG and TIFF are lossless. |
| Format | JPEG, PNG, WebP, JPEG XL or uncompressed 16-bit TIFF. JPEG, WebP and JPEG XL expose quality; JPEG XL also has a lossless switch; PNG and TIFF are lossless. |
| Resize | Full resolution, a long-edge size in pixels, or a percentage of the cropped frame. |
| Quality | Encoder quality, 40–100. 90–95 is visually lossless for most photographs. |
| File name | Template with {name}, {date}, {time} and {index}; the first result is previewed underneath. |
JPEG, PNG, WebP and uncompressed 16-bit TIFF, at full resolution, a long edge, or a percentage of the cropped frame. Output dimensions always reflect the crop and rotation; colour space is sRGB, Display P3 or Adobe RGB with a generated ICC profile.
+JPEG, PNG, WebP, JPEG XL and uncompressed 16-bit TIFF, at full resolution, a long edge, or a percentage of the cropped frame. Output dimensions always reflect the crop and rotation; colour space is sRGB, Display P3 or Adobe RGB with a generated ICC profile.
+JPEG XL is exported at 8-bit in sRGB, either lossy (quality 40–100) or lossless, using libjxl compiled to WebAssembly inside the app — the file is encoded on this computer and nothing is uploaded. There is no embedded ICC profile or XMP metadata in a JXL export yet; use JPEG or 16-bit TIFF when you need those. Chrome 155+, Firefox 158+ and Safari 17+ open .jxl files; Microsoft Edge does not display them yet.