|
5 | 5 | import re |
6 | 6 | import shlex |
7 | 7 | import subprocess |
| 8 | +import sys |
8 | 9 | import tarfile |
9 | 10 | import tempfile |
10 | 11 | import textwrap |
11 | | -from collections import defaultdict, deque, UserDict |
| 12 | +from collections import UserDict, defaultdict, deque |
12 | 13 | from dataclasses import dataclass |
13 | 14 | from enum import Enum |
14 | 15 | from functools import partial |
|
17 | 18 | from pkgcheck import reporters, scan |
18 | 19 | from pkgcore.ebuild.atom import MalformedAtom |
19 | 20 | from pkgcore.ebuild.atom import atom as atom_cls |
20 | | -from pkgcore.ebuild.repository import UnconfiguredTree, tree |
21 | 21 | from pkgcore.ebuild.repo_objs import RepoConfig |
| 22 | +from pkgcore.ebuild.repository import UnconfiguredTree, tree |
22 | 23 | from pkgcore.operations import observer as observer_mod |
23 | 24 | from pkgcore.restrictions import packages |
24 | 25 | from snakeoil.cli import arghparse |
@@ -317,7 +318,12 @@ def _populate(self, pkgs): |
317 | 318 | error = old_files.stderr.read().decode().strip() |
318 | 319 | raise Exception(f"failed populating archive repo: {error}") |
319 | 320 | with tarfile.open(mode="r|", fileobj=old_files.stdout) as tar: |
320 | | - tar.extractall(path=self.location) |
| 321 | + extra_kwargs = {} |
| 322 | + # see filter in https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall |
| 323 | + # Whilst we trust git archive, we still leave the basic protections on. |
| 324 | + if sys.version_info >= (3, 12, 0): |
| 325 | + extra_kwargs["filter"] = "data" |
| 326 | + tar.extractall(path=self.location, **extra_kwargs) |
321 | 327 |
|
322 | 328 |
|
323 | 329 | def change(*statuses): |
|
0 commit comments