feat(server): add safe directory creation to path service

Introduces PathService.createDirectory with comprehensive path validation
to prevent directory traversal and symlink attacks. It validates parent paths
against a blocked list, ensures the parent is a real directory, and blocks
unsafe characters in folder names.

Filesystem errors like EEXIST and EACCES are mapped to standard HTTP
exceptions to provide clear feedback to the client.

Closes #332
This commit is contained in:
neon
2026-06-14 23:44:25 +00:00
parent 445bb39978
commit 49da34ee48
8 changed files with 334 additions and 15 deletions
+1
View File
@@ -43,3 +43,4 @@ export * from "./achievement";
export * from "./reading-session";
export * from "./annotation";
export * from "./hardcover";
export * from "./path";
+11
View File
@@ -0,0 +1,11 @@
export interface DirectoryEntry {
name: string;
path: string;
}
export interface CreateFolderRequest {
parentPath: string;
name: string;
}
export type CreateFolderResult = DirectoryEntry;