diff --git a/sos/cleaner/archives/__init__.py b/sos/cleaner/archives/__init__.py index 70e168d8b9..a729862d57 100644 --- a/sos/cleaner/archives/__init__.py +++ b/sos/cleaner/archives/__init__.py @@ -25,6 +25,12 @@ def extract_archive(archive_path, tmpdir): archive = tarfile.open(archive_path) path = os.path.join(tmpdir, 'cleaner') + # set extract filter since python 3.12 (see PEP-706 for more) + # Because python 3.10 and 3.11 raises false alarms as exceptions + # (see #3330 for examples), we can't use data filter but must + # fully trust the archive (legacy behaviour) + archive.extraction_filter = getattr(tarfile, 'fully_trusted_filter', + (lambda member, path: member)) archive.extractall(path) archive.close() return os.path.join(path, archive.name.split('/')[-1].split('.tar')[0])