Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion kolla/image/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,18 @@ def make_an_archive(items, arcname, item_child_path=None):
image.status = Status.CONNECTION_ERROR
raise ArchivingError
arc_path = os.path.join(image.path, '%s-archive' % arcname)

# NOTE(jneumann): 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(arc_path, 'w') as tar:
tar.add(items_path, arcname=arcname)
tar.add(items_path, arcname=arcname, filter=reset_userinfo)
return len(os.listdir(items_path))

self.logger.debug('Processing')
Expand Down