redline
MediumSecuritytar-extractall

Archive extracted unchecked

Archive extracted unchecked. extractall without a filter can write outside the target folder.

This is how the comment reads inline, under the flagged line.

Why it matters

Archive entries like ../../etc/cron.d/x escape the destination (path traversal, 'tar slip').

What to do

tar.extractall(dest, filter="data").

Examples

Flagged
tar.extractall(dest)
Better
tar.extractall(dest, filter="data")

What it catches

It reads a pattern on each line, aware of strings and comments. Languages: Python. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.

Flagged

tar.extractall(dest)

Left alone

tar.extractall(dest, filter="data")

Research

`tarfile.extractall` with no filter. A crafted archive writes files outside the target folder.

Turn it off or change it

In a config file for the CLI, or in the API's rules field:

{
  "rules": {
    "disable": [
      "tar-extractall"
    ],
    "severity": {
      "tar-extractall": "low"
    }
  }
}

Read the source or report a false positive.