We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 314f49f commit 84d2026Copy full SHA for 84d2026
libs/community/langchain_community/tools/audio/huggingface_text_to_speech_inference.py
@@ -65,6 +65,11 @@ def __init__(
65
f"'{_HUGGINGFACE_API_KEY_ENV_NAME}' must be or set or passed"
66
)
67
68
+ # Sanitize file extension to prevent path traversal attacks
69
+ file_extension = os.path.basename(file_extension).lstrip(".")
70
+ if not file_extension or "/" in file_extension or "\\" in file_extension:
71
+ raise ValueError("Invalid file extension")
72
+
73
if file_naming_func == "uuid":
74
file_namer = lambda: str(uuid.uuid4()) # noqa: E731
75
elif file_naming_func == "timestamp":
0 commit comments