fixed vulenerability in wipe_database endpoint

This commit is contained in:
Saifeddine ALOUI 2024-10-07 21:43:44 +02:00
parent 5f0b0341be
commit 7433f80d2c

View File

@ -136,6 +136,7 @@ async def search(query: RAGQuery):
@router.delete("/wipe_database", response_model=DocumentResponse)
async def wipe_database(key: str):
await validate_key(key)
key = sanitize_path(key)
user_folder = lollmsElfServer.lollms_paths / str(key)
shutil.rmtree(user_folder, ignore_errors=True)
return DocumentResponse(success=True, message="Database wiped successfully.")