aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2024-03-26 12:07:14 +0100
committerGrzegorz Bialas <grzegorz@stackhpc.com>2024-08-27 20:20:32 +0000
commitece67cd2aec82d661ba355ce6bc6e41bb88001b6 (patch)
treefcb8f2647701e5c4b4f5c636c5df84d47e7b6c3a /kolla
parentfd4f1a8a82686bd0766526f007620ad8217b42e5 (diff)
downloadkolla-ece67cd2aec82d661ba355ce6bc6e41bb88001b6.tar.gz
kolla-ece67cd2aec82d661ba355ce6bc6e41bb88001b6.zip
Check if archive is tarfile
Change-Id: I802267d848c1dee722015b0d379bd9210f6c103e
Diffstat (limited to 'kolla')
-rw-r--r--kolla/image/tasks.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/kolla/image/tasks.py b/kolla/image/tasks.py
index 1242ecd8d..a36ba5cea 100644
--- a/kolla/image/tasks.py
+++ b/kolla/image/tasks.py
@@ -308,9 +308,14 @@ 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) # nosec
+ if tarfile.is_tarfile(archive):
+ _test_malicious_tarball(archive, items_path)
+ with tarfile.open(archive, 'r') as archive_tar:
+ archive_tar.extractall(path=items_path) # nosec
+ else:
+ self.logger.error("Archive %s is not a tarfile",
+ archive)
+ raise ArchivingError
else:
try:
os.mkdir(items_path)