Skip to content

fix: issue #203 file type validation + security CVE fixes#204

Merged
the-luap merged 24 commits intobetafrom
fix/github-issues-194-197-main
Mar 2, 2026
Merged

fix: issue #203 file type validation + security CVE fixes#204
the-luap merged 24 commits intobetafrom
fix/github-issues-194-197-main

Conversation

@the-luap
Copy link
Owner

@the-luap the-luap commented Mar 2, 2026

Summary

  • Issue [QUESTION] Requirements for uploading video files (.mp4) #203: Fix video/file upload not working despite adding file types to admin settings — the allowed_file_types DB setting is now dynamically read throughout the entire upload pipeline (frontend file picker, JS validation, backend multer filter, content validator)
  • Security: Resolve all npm audit vulnerabilities (0 in both frontend and backend)
  • Docker CVEs: Upgrade nginx to 1.28-alpine (Alpine 3.23, OpenSSL 3.5.5), upgrade npm to latest in backend production image, add brace-expansion/minimatch overrides

Changes

  • backend/src/services/uploadSettings.js — Dynamic MIME type resolution from DB settings
  • backend/src/routes/adminPhotos.js & gallery.js — Use dynamic allowed types instead of hardcoded lists
  • backend/src/routes/publicSettings.js — Expose allowed_file_types to frontend
  • frontend/src/utils/fileTypes.ts — Shared extension-to-MIME mapping utilities
  • frontend/src/components/admin/PhotoUpload.tsx & gallery/UserPhotoUpload.tsx — Dynamic file type validation
  • backend/Dockerfile & frontend/Dockerfile & frontend/Dockerfile.prod — Security hardening
  • backend/package.json — npm overrides for transitive dependency CVEs

Test plan

  • Playwright E2E tests pass (41 passed, 3 pre-existing failures, 13 skipped)
  • npm audit returns 0 vulnerabilities for both frontend and backend
  • Docker containers build and run successfully
  • Admin login and gallery functionality verified

the-luap and others added 24 commits January 15, 2026 06:45
fix: CI workflow fixes for protected branches
fix: watermark thumbnails, custom logo display, and German translations
…ic footer year (#108)

fix: lightbox watermark loading, white label translations, and dynamic footer year
fix: database migration restart bug, lightbox loading spinner, and watermark cache invalidation
fix: dynamic website title from branding settings
Resolved conflicts in CHANGELOG.md, backend/package.json, and
frontend/package.json. Version set to 3.15.1.
Release v3.15.1: Merge beta to main
- #194: Send full date format object instead of just format string to prevent JSON parse errors
- #195: Remove non-functional forgot password link, fix README port 3005 -> 3000
- #196: Use ADMIN_PASSWORD env var in migration, update existing user in create-admin script instead of failing
- #197: Convert camelCase filter keys to snake_case in photo export to match backend PhotoFilterBuilder
The "Allowed File Types" admin setting was stored in the database but
never actually read during upload validation. Both frontend and backend
used hardcoded MIME type lists, causing video uploads (e.g. MP4) to be
rejected even when explicitly added to the setting.

Changes:
- Add getAllowedMimeTypes() to uploadSettings service that reads the
  general_allowed_file_types DB setting and converts extensions to MIME types
- Backend admin upload route now resolves allowed types from settings
  before multer processes files (via resolveAllowedTypes middleware)
- Backend gallery upload route uses dynamic allowed types from settings
- Expose allowed_file_types in public settings API for gallery clients
- Frontend PhotoUpload and UserPhotoUpload components now derive allowed
  MIME types from settings instead of hardcoded image-only lists
- Add shared fileTypes.ts utility for extension-to-MIME conversion

Closes #203
Frontend (6 → 0 vulnerabilities):
- axios: update to fix DoS via __proto__ key in mergeConfig (CVE-2026-25639)
- swiper: update to fix prototype pollution (critical)
- rollup: update to fix arbitrary file write via path traversal
- minimatch: update to fix multiple ReDoS vulnerabilities
- ajv: update to fix ReDoS with $data option
- markdown-it: update to fix ReDoS

Backend (32 → 0 vulnerabilities):
- multer: update to fix DoS via incomplete cleanup and resource exhaustion
- minimatch: update to fix multiple ReDoS vulnerabilities
- Add npm overrides for transitive dependencies:
  - fast-xml-parser >=5.3.8 (fixes XSS, DoS, stack overflow via AWS SDK)
  - qs >=6.14.2 (fixes arrayLimit bypass DoS via Express)
  - tar >=7.5.8 (fixes path traversal and hardlink attacks via sqlite3)

Docker:
- Pin nginx base image to 1.27-alpine in Dockerfile.prod
- Update security comments in backend Dockerfile
- Existing apk upgrade --no-cache ensures OpenSSL/libexpat CVEs are
  patched at build time (OpenSSL 3.5.5, Alpine 3.23.3)
- Upgrade nginx base from 1.27-alpine to 1.28-alpine (Alpine 3.23, OpenSSL 3.5.5)
- Upgrade npm to latest in backend production stage to fix tar, minimatch, brace-expansion CVEs
- Add brace-expansion and minimatch overrides for app-level transitive deps
- Remove incompatible body-parser v2 override (breaks Express 4 JSON parsing)
- Remove npm upgrade from builder stages (npm 11 breaks npm ci with existing lockfile)
@the-luap the-luap merged commit 8017171 into beta Mar 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant