summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2021-03-19 19:09:44 +0800
committerGitHub <noreply@github.com>2021-03-19 19:09:44 +0800
commitd1297f65226e3bfdb31e224c514c362b304c904c (patch)
tree10e34ab1af6bdd7229b2a6da6436447ef4d236f3 /git/repo/base.py
parentd906f31a283785e9864cb1eaf12a27faf4f72c42 (diff)
parentd283c83c43f5e52a1a14e55b35ffe85a780615d8 (diff)
downloadgitpython-d1297f65226e3bfdb31e224c514c362b304c904c.tar.gz
Merge pull request #1198 from RyaxTech/replace-password-in-uri-by-stars
Replace password in URI by stars if present to avoid leaking secrets in logs
Diffstat (limited to 'git/repo/base.py')
-rw-r--r--git/repo/base.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 24bc5754..a28c9d28 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -25,7 +25,7 @@ from git.index import IndexFile
from git.objects import Submodule, RootModule, Commit
from git.refs import HEAD, Head, Reference, TagReference
from git.remote import Remote, add_progress, to_progress_instance
-from git.util import Actor, finalize_process, decygpath, hex_to_bin, expand_path
+from git.util import Actor, finalize_process, decygpath, hex_to_bin, expand_path, remove_password_if_present
import os.path as osp
from .fun import rev_parse, is_git_dir, find_submodule_git_dir, touch, find_worktree_git_dir
@@ -1018,7 +1018,10 @@ class Repo(object):
finalize_process, decode_streams=False)
else:
(stdout, stderr) = proc.communicate()
- log.debug("Cmd(%s)'s unused stdout: %s", getattr(proc, 'args', ''), stdout)
+ cmdline = getattr(proc, 'args', '')
+ cmdline = remove_password_if_present(cmdline)
+
+ log.debug("Cmd(%s)'s unused stdout: %s", cmdline, stdout)
finalize_process(proc, stderr=stderr)
# our git command could have a different working dir than our actual