Archive extracted unchecked
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
tar.extractall(dest)
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"
}
}
}
extractallwithout a filter can write outside the target folder.