Skip to content

Commit

Permalink
add tarfile.data_filter to all tar filters to address secruity audit
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Aug 30, 2024
1 parent f606eef commit 7cbf6ba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions comfy_cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ def extract_tarball(

_size = 0

def _filter(tinfo: tarfile.TarInfo, _path: Optional[PathLike] = None):
def _filter(tinfo: tarfile.TarInfo, _path: PathLike):
nonlocal _size
pathProg.update(pathTask, description=tinfo.path)
barProg.advance(barTask, _size)
_size = tinfo.size
return tinfo

return tarfile.data_filter(tinfo, _path)
else:
_filter = None

Expand Down Expand Up @@ -214,12 +215,13 @@ def create_tarball(

_size = 0

def _filter(tinfo: tarfile.TarInfo):
def _filter(tinfo: tarfile.TarInfo, _path: PathLike):
nonlocal _size
pathProg.update(pathTask, description=tinfo.path)
barProg.advance(barTask, _size)
_size = Path(tinfo.path).stat().st_size
return tinfo

return tarfile.data_filter(tinfo, _path)
else:
_filter = None

Expand Down

0 comments on commit 7cbf6ba

Please sign in to comment.