1
0
Fork 0
mirror of https://github.com/maziggy/bambuddy.git synced 2026-05-09 08:25:54 +02:00

[PR #339] [CLOSED] Add external folder mounting support for NAS/USB/network shares #1007

Closed
opened 2026-05-07 00:15:27 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/maziggy/bambuddy/pull/339
Author: @S1N4X
Created: 2/12/2026
Status: Closed

Base: mainHead: feature/external-folder-mounting


📝 Commits (10+)

  • 6d3ba37 test
  • 9aece16 Implement external folder mounting feature (#124)
  • df4a62b Fix TypeScript compilation errors and add test results
  • b7a12a0 Remove hidden files toggle from external folder mounting
  • d44de08 Match ExternalFolderModal styling to standard modals
  • 903c97f Fix JSX structure in ExternalFolderModal
  • c785733 Remove file extensions filter from external folder mounting
  • b61fda7 Add tests and documentation for external folder mounting
  • 552fff8 Remove planning and testing artifacts
  • a890353 Protect external files from accidental deletion and enforce read-only constraints

📊 Changes

21 files changed (+3506 additions, -42 deletions)

View changed files

📝 README.md (+3 -0)
📝 backend/app/api/routes/library.py (+429 -21)
📝 backend/app/api/routes/settings.py (+3 -0)
📝 backend/app/core/database.py (+47 -0)
📝 backend/app/models/library.py (+13 -0)
📝 backend/app/schemas/library.py (+77 -0)
📝 backend/app/schemas/settings.py (+24 -0)
backend/app/services/external_library.py (+407 -0)
backend/tests/integration/test_external_folder_protection.py (+421 -0)
backend/tests/unit/services/test_external_library.py (+499 -0)
📝 docker-compose.yml (+3 -0)
docs/external-folder-mounting.md (+219 -0)
frontend/src/__tests__/components/ExternalFolderModal.test.tsx (+383 -0)
frontend/src/__tests__/components/ExternalFolderSettings.test.tsx (+292 -0)
📝 frontend/src/api/client.ts (+92 -6)
📝 frontend/src/components/ConfirmModal.tsx (+3 -0)
frontend/src/components/ExternalFolderModal.tsx (+207 -0)
frontend/src/components/ExternalFolderSettings.tsx (+184 -0)
📝 frontend/src/pages/FileManagerPage.tsx (+148 -13)
📝 frontend/src/pages/SettingsPage.tsx (+31 -2)

...and 1 more files

📄 Description

Summary

Adds support for mounting external directories (NAS shares, USB drives, network storage) to Bambuddy's File Manager with proper security protections.

Changes

  • Backend: New ExternalLibraryService with security validation and smart refresh
  • Frontend: ExternalFolderModal and ExternalFolderSettings components
  • Database: Schema updates for external folder metadata (is_external, external_path, external_readonly, etc.)
  • API: 4 new endpoints + updates to existing endpoints for external folder operations
  • Security: Path validation, system directory blocking, read-only enforcement, symlink prevention
  • Tests: 36 backend unit tests + 16 integration tests + 58 frontend tests

Features

  • Mount external directories with path validation
  • Real-time file discovery with recursive scanning
  • Read-only and read-write modes with safety defaults
  • Smart refresh using mtime caching
  • Allowlist-based path access control
  • System directory blocking and symlink prevention
  • Visual indicators (link, lock, warning icons)
  • Rescan with change detection

Critical Protections (added in final commit)

These 3 issues were identified during integration review and fixed:

  1. Delete protection: External files are only removed from the database by default. Physical deletion requires an explicit opt-in via checkbox in the UI (and delete_from_filesystem=true API parameter). Read-only folders block all physical deletion.

  2. Upload validation: Uploads and ZIP extraction to read-only external folders now return 403 Forbidden.

  3. Move validation: Moving files from/to read-only external folders now returns 403 Forbidden.

Testing

  • Backend unit tests: 36 passing (external library service)
  • Backend integration tests: 16 new tests for delete/upload/move protections
  • Frontend: 29 FileManagerPage tests passing, 17 ConfirmModal tests passing
  • Pre-existing failures in ExternalFolderModal/Settings tests (unrelated to this PR)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/maziggy/bambuddy/pull/339 **Author:** [@S1N4X](https://github.com/S1N4X) **Created:** 2/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/external-folder-mounting` --- ### 📝 Commits (10+) - [`6d3ba37`](https://github.com/maziggy/bambuddy/commit/6d3ba37fb08fec2dac8fdcae47fd3f147cba0469) test - [`9aece16`](https://github.com/maziggy/bambuddy/commit/9aece16aa6309ecc104c57adaa1a88ead2a4ba6d) Implement external folder mounting feature (#124) - [`df4a62b`](https://github.com/maziggy/bambuddy/commit/df4a62b5c8a125d38004f6579f8f8d3fb3d8ce26) Fix TypeScript compilation errors and add test results - [`b7a12a0`](https://github.com/maziggy/bambuddy/commit/b7a12a018db1691d3ab8cf66d44b2af43463b1aa) Remove hidden files toggle from external folder mounting - [`d44de08`](https://github.com/maziggy/bambuddy/commit/d44de0855a31d5eec3befc672434ccba1d0d7c19) Match ExternalFolderModal styling to standard modals - [`903c97f`](https://github.com/maziggy/bambuddy/commit/903c97fa96de291e32b44e6316c9401016f813c1) Fix JSX structure in ExternalFolderModal - [`c785733`](https://github.com/maziggy/bambuddy/commit/c78573359aeb32e3320a199aa2a62b187baf83de) Remove file extensions filter from external folder mounting - [`b61fda7`](https://github.com/maziggy/bambuddy/commit/b61fda7e37eb7661866a1cf36a43cb3f09773337) Add tests and documentation for external folder mounting - [`552fff8`](https://github.com/maziggy/bambuddy/commit/552fff8179feef8414a949bd571fd34bfb3a58d8) Remove planning and testing artifacts - [`a890353`](https://github.com/maziggy/bambuddy/commit/a8903534a09083edadf796e36bf60f60aa80bfff) Protect external files from accidental deletion and enforce read-only constraints ### 📊 Changes **21 files changed** (+3506 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -0) 📝 `backend/app/api/routes/library.py` (+429 -21) 📝 `backend/app/api/routes/settings.py` (+3 -0) 📝 `backend/app/core/database.py` (+47 -0) 📝 `backend/app/models/library.py` (+13 -0) 📝 `backend/app/schemas/library.py` (+77 -0) 📝 `backend/app/schemas/settings.py` (+24 -0) ➕ `backend/app/services/external_library.py` (+407 -0) ➕ `backend/tests/integration/test_external_folder_protection.py` (+421 -0) ➕ `backend/tests/unit/services/test_external_library.py` (+499 -0) 📝 `docker-compose.yml` (+3 -0) ➕ `docs/external-folder-mounting.md` (+219 -0) ➕ `frontend/src/__tests__/components/ExternalFolderModal.test.tsx` (+383 -0) ➕ `frontend/src/__tests__/components/ExternalFolderSettings.test.tsx` (+292 -0) 📝 `frontend/src/api/client.ts` (+92 -6) 📝 `frontend/src/components/ConfirmModal.tsx` (+3 -0) ➕ `frontend/src/components/ExternalFolderModal.tsx` (+207 -0) ➕ `frontend/src/components/ExternalFolderSettings.tsx` (+184 -0) 📝 `frontend/src/pages/FileManagerPage.tsx` (+148 -13) 📝 `frontend/src/pages/SettingsPage.tsx` (+31 -2) _...and 1 more files_ </details> ### 📄 Description ## Summary Adds support for mounting external directories (NAS shares, USB drives, network storage) to Bambuddy's File Manager with proper security protections. ## Changes - **Backend**: New ExternalLibraryService with security validation and smart refresh - **Frontend**: ExternalFolderModal and ExternalFolderSettings components - **Database**: Schema updates for external folder metadata (is_external, external_path, external_readonly, etc.) - **API**: 4 new endpoints + updates to existing endpoints for external folder operations - **Security**: Path validation, system directory blocking, read-only enforcement, symlink prevention - **Tests**: 36 backend unit tests + 16 integration tests + 58 frontend tests ## Features - Mount external directories with path validation - Real-time file discovery with recursive scanning - Read-only and read-write modes with safety defaults - Smart refresh using mtime caching - Allowlist-based path access control - System directory blocking and symlink prevention - Visual indicators (link, lock, warning icons) - Rescan with change detection ## Critical Protections (added in final commit) These 3 issues were identified during integration review and fixed: 1. **Delete protection**: External files are only removed from the database by default. Physical deletion requires an explicit opt-in via checkbox in the UI (and `delete_from_filesystem=true` API parameter). Read-only folders block all physical deletion. 2. **Upload validation**: Uploads and ZIP extraction to read-only external folders now return 403 Forbidden. 3. **Move validation**: Moving files from/to read-only external folders now returns 403 Forbidden. ## Testing - Backend unit tests: 36 passing (external library service) - Backend integration tests: 16 new tests for delete/upload/move protections - Frontend: 29 FileManagerPage tests passing, 17 ConfirmModal tests passing - Pre-existing failures in ExternalFolderModal/Settings tests (unrelated to this PR) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:15:27 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy-maziggy-1#1007
No description provided.