- Upgrade next 16.0.3 -> 16.3.5 and react/react-dom 19.2.0 -> 19.3.0
(CVE-2025-55182 / CVE-2025-66478 unauthenticated RCE), next-auth -> 4.24.15
- Require admin role on /api/users, /api/courses and /api/enrollments,
which were unauthenticated
- Replace ALLOWED_ADMINS checks that allowed any signed-in user when the
variable was empty with the role-based requireAdmin
- Sanitize upload filenames, restrict thumbnail extensions, store edited
thumbnails in UPLOADS_DIR, tighten traversal checks in file routes
- Dockerfile: Node 22, pinned pnpm, non-root user, critical audit gate
- Compose: read-only rootfs, dropped caps, no-new-privileges, Postgres
password from env
- Exclude .env from Docker build context; add security headers
- Deploy with git reset --hard instead of git pull
- Remove stale package-lock.json
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- Cast the transcoder upload body to node:stream/web ReadableStream;
the DOM ReadableStream type lacks the async-iterator members
Readable.fromWeb expects
- Exclude transcoder/ and transcoder-remote/ from the root tsconfig:
they are standalone sub-projects with their own tsconfig and
dependencies (e.g. archiver) that aren't installed in the root
node_modules, so next build's typecheck can never resolve them
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
req.formData() parsed the entire multipart body into RAM, so large
uploads (1.6GB+) OOM-killed the server. Bridge the web Request body to
a Node stream and parse it with formidable, which writes the file to
disk as it arrives:
- Temp dir is /uploads/tmp (same filesystem as the destination) so the
post-parse move is an atomic rename, not a second multi-GB write
- Mark the bridged request as chunked when a proxy strips
content-length, otherwise formidable assumes an empty body
- Track formidable temp files via fileBegin so aborted uploads get
their partial files cleaned up
- Remove the dead formidable branch gated on (req as any).req, which
is always null in the App Router
Also fix the nginx example in VPS_UPLOAD_CONFIG.md: client_max_body_size
was 1024M, below the app's 2.5GB limit, and would 413 large uploads at
the proxy before they reached the app.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>