Merge pull request #20 from gamosoft/delete-folder-check
fixed security issue with notes deletion (#19)
This commit is contained in:
commit
bb76ca9021
|
|
@ -132,6 +132,11 @@ def delete_folder(notes_dir: str, folder_path: str) -> bool:
|
||||||
try:
|
try:
|
||||||
full_path = Path(notes_dir) / folder_path
|
full_path = Path(notes_dir) / folder_path
|
||||||
|
|
||||||
|
# Security check: ensure the path is within notes_dir
|
||||||
|
if not validate_path_security(notes_dir, full_path):
|
||||||
|
print(f"Security: Path is outside notes directory: {full_path}")
|
||||||
|
return False
|
||||||
|
|
||||||
if not full_path.exists():
|
if not full_path.exists():
|
||||||
print(f"Folder does not exist: {full_path}")
|
print(f"Folder does not exist: {full_path}")
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue