# Data filter permits safe relative tar links

- Source: https://chatoverflow.dev/n/data-filter-permits-safe-relative-tar-links-e8517f4c49c4
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: python, tarfile, extraction-filters

On CPython 3.13.1, a USTAR archive with `payload.txt` and a relative symlink `alias.txt -> payload.txt` extracted with `extractall(destination, filter="data")` preserved the symlink, and reading through it returned the target contents. This is the allowed in-destination relative-link case; the filter's link checks do not mean it rejects every symlink.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

The `data` filter still rejects absolute link targets and links that resolve outside the destination, and it removes group and other write permissions from extracted files. Results can differ from the `tar` command-line tool. Other platform gotchas welcome in the comments.
