@@ -40,9 +40,11 @@ Some facts and figures:
40
40
Archives are extracted using a :ref: `filter <tarfile-extraction-filter >`,
41
41
which makes it possible to either limit surprising/dangerous features,
42
42
or to acknowledge that they are expected and the archive is fully trusted.
43
- By default, archives are fully trusted, but this default is deprecated
44
- and slated to change in Python 3.14.
45
43
44
+ .. versionchanged :: 3.14
45
+ The default extraction filter was 'fully trusted' but is now 'data' which
46
+ which disallows dangerous features like links to absolute paths or paths
47
+ outside the destination.
46
48
47
49
.. function :: open(name=None, mode='r', fileobj=None, bufsize=10240, **kwargs)
48
50
@@ -495,19 +497,23 @@ be finalized; only the internally used file object will be closed. See the
495
497
The *filter * argument specifies how ``members `` are modified or rejected
496
498
before extraction.
497
499
See :ref: `tarfile-extraction-filter ` for details.
498
- It is recommended to set this explicitly depending on which *tar * features
499
- you need to support .
500
+ It is recommended to set this explicitly only if unusual *tar * features
501
+ are required .
500
502
501
503
.. warning ::
502
504
503
- Never extract archives from untrusted sources without prior inspection.
505
+ The default filter is set to ``filter='data' `` to prevent the most
506
+ dangerous security issues, read the :ref: `tarfile-extraction-filter `
507
+ section for details.
508
+
509
+ Never extract archives from untrusted sources without prior inspection,
510
+ even when using the ``'data' `` filter, but especially if using the
511
+ ``'tar' `` or ``'fully_trusted' `` filters.
512
+
504
513
It is possible that files are created outside of *path *, e.g. members
505
514
that have absolute filenames starting with ``"/" `` or filenames with two
506
515
dots ``".." ``.
507
516
508
- Set ``filter='data' `` to prevent the most dangerous security issues,
509
- and read the :ref: `tarfile-extraction-filter ` section for details.
510
-
511
517
.. versionchanged :: 3.5
512
518
Added the *numeric_owner * parameter.
513
519
@@ -538,8 +544,9 @@ be finalized; only the internally used file object will be closed. See the
538
544
539
545
See the warning for :meth: `extractall `.
540
546
541
- Set ``filter='data' `` to prevent the most dangerous security issues,
542
- and read the :ref: `tarfile-extraction-filter ` section for details.
547
+ The default filter is set to ``filter='data' `` to prevent the most
548
+ dangerous security issues, read the :ref: `tarfile-extraction-filter `
549
+ section for details.
543
550
544
551
.. versionchanged :: 3.2
545
552
Added the *set_attrs * parameter.
@@ -603,12 +610,7 @@ be finalized; only the internally used file object will be closed. See the
603
610
argument to :meth: `~TarFile.extract `.
604
611
605
612
If ``extraction_filter `` is ``None `` (the default),
606
- calling an extraction method without a *filter * argument will raise a
607
- ``DeprecationWarning ``,
608
- and fall back to the :func: `fully_trusted <fully_trusted_filter> ` filter,
609
- whose dangerous behavior matches previous versions of Python.
610
-
611
- In Python 3.14+, leaving ``extraction_filter=None `` will cause
613
+ calling an extraction method without a *filter * argument will cause
612
614
extraction methods to use the :func: `data <data_filter> ` filter by default.
613
615
614
616
The attribute may be set on instances or overridden in subclasses.
@@ -992,12 +994,7 @@ can be:
992
994
993
995
* ``None `` (default): Use :attr: `TarFile.extraction_filter `.
994
996
995
- If that is also ``None `` (the default), raise a ``DeprecationWarning ``,
996
- and fall back to the ``'fully_trusted' `` filter, whose dangerous behavior
997
- matches previous versions of Python.
998
-
999
- In Python 3.14, the ``'data' `` filter will become the default instead.
1000
- It's possible to switch earlier; see :attr: `TarFile.extraction_filter `.
997
+ If that is also ``None `` (the default), the ``'data' `` filter will be used.
1001
998
1002
999
* A callable which will be called for each extracted member with a
1003
1000
:ref: `TarInfo <tarinfo-objects >` describing the member and the destination
0 commit comments