Skip to content

Python 3.12 adds further protection for tarfile module #1025

@ericwb

Description

@ericwb

Is your feature request related to a problem? Please describe.
From Python 3.12 docs:

The extraction methods in tarfile, and shutil.unpack_archive(), have a new a filter argument that allows limiting tar features than may be surprising or dangerous, such as creating files outside the destination directory. See Extraction filters for details. In Python 3.14, the default will switch to 'data'. (Contributed by Petr Viktorin in PEP 706.)

Describe the solution you'd like
Bandit should take advantage of this new tarfile function.

Describe alternatives you've considered
n/a

Additional context
https://docs.python.org/3.12/whatsnew/3.12.html#new-features

Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions