mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
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:
@@ -43,3 +43,4 @@ export * from "./achievement";
|
||||
export * from "./reading-session";
|
||||
export * from "./annotation";
|
||||
export * from "./hardcover";
|
||||
export * from "./path";
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
export interface DirectoryEntry {
|
||||
name: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface CreateFolderRequest {
|
||||
parentPath: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type CreateFolderResult = DirectoryEntry;
|
||||
Reference in New Issue
Block a user