Skip to content

Commit 405f950

Browse files
committed
Remove Git remote origin after cloning sources
When kolla is cloning a Git repository during the build process, the `.git/config` file retains the remote origin URL, which may expose sensitive credentials if authentication tokens are embedded in the URL. This fix ensures that the remote is removed after cloning to prevent unintended exposure of credentials. Closes-Bug: #2098904 Change-Id: Iec21fc2363e03133ec77326da7392bc25b40132a
1 parent 6d44736 commit 405f950

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

kolla/image/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def reset_userinfo(tarinfo):
232232
git.Git().clone(source['source'], clone_dir)
233233
git.Git(clone_dir).checkout(source['reference'])
234234
reference_sha = git.Git(clone_dir).rev_parse('HEAD')
235+
git.Git(clone_dir).remote("remove", "origin")
235236
self.logger.debug("Git checkout by reference %s (%s)",
236237
source['reference'], reference_sha)
237238
except Exception as e:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Removes Git remote URLs after cloning to prevent credential exposure.
5+
`LP#2098904 <https://bugs.launchpad.net/kolla/+bug/2098904>`__

0 commit comments

Comments
 (0)