aboutsummaryrefslogtreecommitdiff
path: root/kolla/image
diff options
context:
space:
mode:
Diffstat (limited to 'kolla/image')
-rw-r--r--kolla/image/tasks.py11
-rw-r--r--kolla/image/unbuildable.py2
2 files changed, 12 insertions, 1 deletions
diff --git a/kolla/image/tasks.py b/kolla/image/tasks.py
index 5038c1d52..091f41f65 100644
--- a/kolla/image/tasks.py
+++ b/kolla/image/tasks.py
@@ -264,6 +264,14 @@ class BuildTask(EngineTask):
def builder(self, image):
+ def _test_malicious_tarball(archive, path):
+ tar_file = tarfile.open(archive, 'r|gz')
+ for n in tar_file.getnames():
+ if not os.path.abspath(os.path.join(path, n)).startswith(path):
+ tar_file.close()
+ self.logger.error(f'Unsafe filenames in archive {archive}')
+ raise ArchivingError
+
def make_an_archive(items, arcname, item_child_path=None):
if not item_child_path:
item_child_path = arcname
@@ -277,8 +285,9 @@ class BuildTask(EngineTask):
archives.append(archive_path)
if archives:
for archive in archives:
+ _test_malicious_tarball(archive, items_path)
with tarfile.open(archive, 'r') as archive_tar:
- archive_tar.extractall(path=items_path)
+ archive_tar.extractall(path=items_path) # nosec
else:
try:
os.mkdir(items_path)
diff --git a/kolla/image/unbuildable.py b/kolla/image/unbuildable.py
index dc5183162..c27eb9593 100644
--- a/kolla/image/unbuildable.py
+++ b/kolla/image/unbuildable.py
@@ -24,6 +24,7 @@ UNBUILDABLE_IMAGES = {
# Issues for SHA1 keys:
# https://github.com/grafana/grafana/issues/41036
'centos': {
+ "bifrost-base", # EPEL-related breakage
"hacluster-pcs", # Missing crmsh package
"nova-spicehtml5proxy", # Missing spicehtml5 package
"ovsdpdk", # Not supported on CentOS
@@ -34,6 +35,7 @@ UNBUILDABLE_IMAGES = {
},
'rocky': {
+ "bifrost-base", # EPEL-related breakage
"hacluster-pcs", # Missing crmsh package
"nova-spicehtml5proxy", # Missing spicehtml5 package
"ovsdpdk", # Not supported on CentOS