dvershinin / lastversion

Assert statement used outside of tests BAN-B101
Security
Major
3 months ago2 years old
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
345            raise TarPathTraversalException("Attempted Path Traversal in Tar File")
346
347        contents: list[tarfile.TarInfo] = archive_file.getmembers()
348        assert contents, "Empty TAR archive"349        top_dir = Path(contents[0].name).resolve()
350        only_one_top_dir = True
351        # If the directory is .app, it's a macOS app bundle, don't strip it
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
376    archive_file: zipfile.ZipFile
377    with zipfile.ZipFile(buffer, "r") as archive_file:
378        contents = archive_file.infolist()
379        assert contents, "Empty archive"380        top_dir = Path(contents[0].filename).resolve()
381        only_one_top_dir = True
382        # If the directory is .app, it's a macOS app bundle, don't strip it