Test files › Archives › valid.tar.gz

Sample TAR+GZIP file (valid.tar)

The gzip-compressed form of a tar archive - the ubiquitous .tar.gz.

↓ Download valid.tar.gz
Filenamevalid.tar.gz
FormatTAR+GZIP
Size188 bytes (188 bytes)
MIME typeapplication/gzip
SHA-2560da101bf8694244200910ca6601eb14a9b7cd9cc543af255392559d3521d2548
What this file catchesThe two-stage decode (gunzip, then untar) that trips code expecting a single compression step. Also a media-type check: .tar.gz is application/gzip on the outside, not application/x-tar.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

Extract with the 'data' filter (Python 3.12+, and backported to security releases of 3.8 to 3.11). It refuses absolute paths, '..', links that point outside the folder and device files. Python 3.14 makes it the default, but passing it keeps older versions safe.

import tarfile

with tarfile.open("valid.tar.gz") as tar:  # detects gzip, bzip2 and xz by itself
    try:
        tar.extractall("out", filter="data")
        print("extracted:", ", ".join(m.name for m in tar.getmembers()))
    except tarfile.FilterError as e:
        print("blocked:", e)

Run against this file, it prints: extracted: readme.txt, logs/app.log

Related guides and tools

Sample 7z, TAR and GZIP filesUpload validation checklistFile signaturesCheck a file's real typeVerify its SHA-256

Download & verify

curl -fsSL -o "valid.tar.gz" "https://files.hexaqa.com/archive/valid.tar.gz"
curl -fsSL "https://files.hexaqa.com/archive/valid.tar.gz" | sha256sum # expect: 0da101bf8694244200910ca6601eb14a9b7cd9cc543af255392559d3521d2548

More archives test files

unicode-entry-names.zipvalid-flat.zipvalid-nested-dirs.zipvalid.tarzip-slip-traversal.zipabsolute-path.zipcorrupt-central-directory.zipempty.zip

← All Archives files