Skip to content
Snippets Groups Projects
Commit e833dc23 authored by Michael Gmelin's avatar Michael Gmelin
Browse files

sysutils/iocage: Update to 1.10

parent 3ba87c7c
No related branches found
No related tags found
No related merge requests found
PORTNAME= iocage
PORTVERSION= 1.8
PORTREVISION= 2
PORTVERSION= 1.10
CATEGORIES= sysutils python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
......
TIMESTAMP = 1726817130
SHA256 (freebsd-iocage-1.8_GH0.tar.gz) = 5fa7259ba1f48693d5ce5e3ce6f3bf2c06a4872e1a83497dff62949133353934
SIZE (freebsd-iocage-1.8_GH0.tar.gz) = 758358
TIMESTAMP = 1734695580
SHA256 (freebsd-iocage-1.10_GH0.tar.gz) = 4e53137b1c91d964a560c38945acfb4a59e2c57162ebc9302b8b90639a1a71b5
SIZE (freebsd-iocage-1.10_GH0.tar.gz) = 815548
--- iocage_lib/ioc_fetch.py.orig 2024-09-20 06:45:27 UTC
+++ iocage_lib/ioc_fetch.py
@@ -47,6 +47,29 @@ import iocage_lib.ioc_start
from iocage_lib.pools import Pool
from iocage_lib.dataset import Dataset
+# taken from tarfile.tar_filter (and _get_filtered_attrs)
+# basically the same, but **without**:
+# - Clear high mode bits (setuid, setgid, sticky) and
+# group/other write bits (S_IWGRP | S_IWOTH).
+def untar_release_filter(member, dest_path):
+ new_attrs = {}
+ name = member.name
+ dest_path = os.path.realpath(dest_path)
+ # Strip leading / (tar's directory separator) from filenames.
+ # Include os.sep (target OS directory separator) as well.
+ if name.startswith(('/', os.sep)):
+ name = new_attrs['name'] = member.path.lstrip('/' + os.sep)
+ if os.path.isabs(name):
+ # Path is absolute even after stripping.
+ # For example, 'C:/foo' on Windows.
+ raise tarfile.AbsolutePathError(member)
+ # Ensure we stay in the destination
+ target_path = os.path.realpath(os.path.join(dest_path, name))
+ if os.path.commonpath([target_path, dest_path]) != dest_path:
+ raise tarfile.OutsideDestinationError(member, target_path)
+ if new_attrs:
+ return member.replace(**new_attrs, deep=False)
+ return member
class IOCFetch:
@@ -817,7 +840,7 @@ class IOCFetch:
# removing them first.
member = self.__fetch_extract_remove__(f)
member = self.__fetch_check_members__(member)
- f.extractall(dest, members=member)
+ f.extractall(dest, members=member, filter=untar_release_filter)
def fetch_update(self, cli=False, uuid=None):
"""This calls 'freebsd-update' to update the fetched RELEASE."""
--- iocage_lib/ioc_plugin.py.orig 2024-09-20 06:45:27 UTC
+++ iocage_lib/ioc_plugin.py
@@ -61,7 +61,10 @@ from iocage_lib.dataset import Dataset
GIT_LOCK = threading.Lock()
RE_PLUGIN_VERSION = re.compile(r'"path":"([/\.\+,\d\w-]*)\.txz"')
+# deliberately crash if tarfile doesn't have required filter
+tarfile.tar_filter
+
class IOCPlugin(object):
"""
@@ -157,7 +160,7 @@ class IOCPlugin(object):
shutil.copyfileobj(r.raw, f)
with tarfile.open(packagesite_txz_path) as p_file:
- p_file.extractall(path=tmpdir)
+ p_file.extractall(path=tmpdir, filter='data')
packagesite_path = os.path.join(tmpdir, 'packagesite.yaml')
if not os.path.exists(packagesite_path):
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment