feat(library): support LIBRARY_BROWSE_ROOT to restrict file path access

Introduce a LIBRARY_BROWSE_ROOT environment variable (defaulting to the
current directory) to restrict directories users can browse and select when
setting up library paths. Add a PathPolicyService on the backend to enforce
path containment checks securely, and update the frontend FolderPickerModal
to prevent navigating above the configured browse root.

Closes #567
This commit is contained in:
neon
2026-07-07 17:02:46 +00:00
parent 0b11583f7d
commit 39d9be30f9
25 changed files with 515 additions and 43 deletions
+4
View File
@@ -40,6 +40,10 @@ NODE_MAX_OLD_SPACE_SIZE=2048
# CORS origin for the frontend when served from a different domain than APP_URL
# CLIENT_URL=https://app.example.com
# Container folder used as the top of the library creation folder picker.
# Defaults to / when unset. Set to /books to hide other container root folders.
# LIBRARY_BROWSE_ROOT=/books
# Set to false only if your platform manages bind mount ownership externally.
# BOOKORBIT_FIX_PERMISSIONS=true