-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: use safe deserialization and tarfile extraction #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -330,7 +330,7 @@ def _get_voice_prompt_dir(voice_prompt_dir: Optional[str], hf_repo: str) -> Opti | |
| if not voices_dir.exists(): | ||
| logger.info(f"extracting {voices_tgz} to {voices_dir}") | ||
| with tarfile.open(voices_tgz, "r:gz") as tar: | ||
| tar.extractall(path=voices_tgz.parent) | ||
| tar.extractall(path=voices_tgz.parent, filter='data') | ||
|
||
|
|
||
| if not voices_dir.exists(): | ||
| raise RuntimeError("voices.tgz did not contain a 'voices/' directory") | ||
|
|
@@ -346,7 +346,7 @@ def _get_static_path(static: Optional[str]) -> Optional[str]: | |
| dist = dist_tgz.parent / "dist" | ||
| if not dist.exists(): | ||
| with tarfile.open(dist_tgz, "r:gz") as tar: | ||
| tar.extractall(path=dist_tgz.parent) | ||
| tar.extractall(path=dist_tgz.parent, filter='data') | ||
|
||
| return str(dist) | ||
| elif static != "none": | ||
| # When set to the "none" string, we don't serve any static content. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tarfile.extractall(..., filter='data')is not supported on Python 3.10/3.11 and will raiseTypeErrorat runtime. Since the project currently supports Python >=3.10, please add a compatibility fallback (manual safe extraction) or bump the minimum supported Python version.