Redact remote URL before logging

The Github driver prints un-sanitized URLs to log files. This PR
uses the redact_url function to sanitize the remote URL before
logging.

Task: #48344
Signed-off-by: Flavio Percoco <flavio@pacerevenue.com>
Change-Id: Id725c8dfe3e4e782c293ff350fc7e35b23d377ab
Signed-off-by: Flavio Percoco <flavio@pacerevenue.com>
This commit is contained in:
Flavio Percoco 2023-08-29 08:59:50 +01:00
parent d4fac1a0e8
commit 334f34bbf4

View File

@ -102,13 +102,15 @@ class Repo(object):
try:
self._setup_known_hosts()
except Exception:
log.exception("Unable to set up known_hosts for %s", remote)
log.exception("Unable to set up known_hosts for %s",
redact_url(remote))
try:
self._ensure_cloned(zuul_event_id)
self._git_set_remote_url(
git.Repo(self.local_path), self.remote_url)
except Exception:
log.exception("Unable to initialize repo for %s", remote)
log.exception("Unable to initialize repo for %s",
redact_url(remote))
def __repr__(self):
return "<Repo {} {}>".format(hex(id(self)), self.local_path)