From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 90AD915817D for ; Sun, 9 Jun 2024 17:54:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C6412E2A8E; Sun, 9 Jun 2024 17:54:36 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A3FB7E2A8E for ; Sun, 9 Jun 2024 17:54:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 61D8433BE00 for ; Sun, 9 Jun 2024 17:54:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 031481BFE for ; Sun, 9 Jun 2024 17:54:34 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1717955611.f620a0769a509966295954c2b0c76e46e8fb4289.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/gpkg.py X-VCS-Directories: lib/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: f620a0769a509966295954c2b0c76e46e8fb4289 X-VCS-Branch: master Date: Sun, 9 Jun 2024 17:54:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8c9576a6-81f6-473b-aefd-74030afdabcb X-Archives-Hash: 3c09b9c054685f37f13fb6e0780ec447 commit: f620a0769a509966295954c2b0c76e46e8fb4289 Author: Zac Medico gentoo org> AuthorDate: Sun Jun 2 21:53:04 2024 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Jun 9 17:53:31 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f620a076 tar_safe_extract: Use tarfile.fully_trusted_filter This suppresses a DeprecationWarning triggered because the tarfile.data_filter will become the new default in python3.14. The fully_trusted filter should be suitable here because tar_safe_extract already performs security validation on tar members prior to extraction. Bug: https://bugs.gentoo.org/933433 Signed-off-by: Zac Medico gentoo.org> lib/portage/gpkg.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py index 9606f6d3c8..fdb54c69b8 100644 --- a/lib/portage/gpkg.py +++ b/lib/portage/gpkg.py @@ -628,6 +628,15 @@ class tar_safe_extract: if self.closed: raise OSError("Tar file is closed.") temp_dir = tempfile.TemporaryDirectory(dir=dest_dir) + # The below tar member security checks can be refactored as a filter function + # that raises an exception. Use tarfile.fully_trusted_filter for now, which + # is simply an identity function: + # def fully_trusted_filter(member, dest_path): + # return member + try: + self.tar.extraction_filter = tarfile.fully_trusted_filter + except AttributeError: + pass try: while True: member = self.tar.next()