aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
Diffstat (limited to 'kolla')
-rwxr-xr-xkolla/image/build.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py
index 3d4fcc27a..4a6ecd495 100755
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -368,8 +368,18 @@ class BuildTask(DockerTask):
image.status = Status.ERROR
return
+ # NOTE(mgoddard): Change ownership of files to root:root. This
+ # avoids an issue introduced by the fix for git CVE-2022-24765,
+ # which breaks PBR when the source checkout is not owned by the
+ # user installing it. LP#1969096
+ def reset_userinfo(tarinfo):
+ tarinfo.uid = tarinfo.gid = 0
+ tarinfo.uname = tarinfo.gname = "root"
+ return tarinfo
+
with tarfile.open(dest_archive, 'w') as tar:
- tar.add(clone_dir, arcname=os.path.basename(clone_dir))
+ tar.add(clone_dir, arcname=os.path.basename(clone_dir),
+ filter=reset_userinfo)
elif source.get('type') == 'local':
self.logger.debug("Getting local archive from %s",