Bumps the version, moves the changelog entry out of Unreleased, updates the guide to version 1.3 and regenerates its PDF, and records the security audit in the release notes.
7.4 KiB
Security audit
Date: 1 December 2026 · Version: 0.5.4 · 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 withtimingSafeEqual. 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,Securewhen 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
requireAdminchecks cover the admin surface; missing or disabled accounts are rejected; the desktop local owner is only used whenLUMINARY_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.relativeagainstdist; tether file names go throughbasenameand must match exactly; stored files are addressed by generated IDs. - Uploads:
MAX_UPLOADenforced againstcontent-lengthbefore reading and again while streaming. - Headers: CSP with
object-src 'none',frame-ancestors 'self',nosniff,SAMEORIGIN,same-originreferrer policy, restrictivePermissions-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 fromLUMINARY_SECRET_KEYor a0600file beside the database. No credentials or API keys are committed.
Hardening opportunities (not vulnerabilities)
- 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. - 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.
- 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.
- 30-day sessions with no rotation on privilege change. Revoking sessions on password change is worth adding.
- No HSTS, no built-in TLS. Correct for a loopback desktop app; for team installs it depends on a reverse proxy, so document that.
secret.keybeside the database protects backups and dumps, not a full data-directory compromise.LUMINARY_SECRET_KEYis the stronger option and should be recommended for team installs.- 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 productionnode_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
onnxruntime-node@1.31.1with a denoise regression run (clears both production highs).- Tighten CSP to
'wasm-unsafe-eval'and re-test raw, JXL and denoise loading. - Vite/Vitest major upgrade on a branch (clears every dev advisory).
- Seal the Immich API key if it is not already sealed.
- Add
npm audit --omit=dev --audit-level=hightoscripts/predeploy.mjs.