summaryrefslogtreecommitdiff
path: root/test/test_repo.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 /test/test_repo.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 'test/test_repo.py')
-rw-r--r--test/test_repo.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_repo.py b/test/test_repo.py
index d5ea8664..8dc17833 100644
--- a/test/test_repo.py
+++ b/test/test_repo.py
@@ -238,6 +238,21 @@ class TestRepo(TestBase):
except UnicodeEncodeError:
self.fail('Raised UnicodeEncodeError')
+ @with_rw_directory
+ def test_leaking_password_in_clone_logs(self, rw_dir):
+ password = "fakepassword1234"
+ try:
+ Repo.clone_from(
+ url="https://fakeuser:{}@fakerepo.example.com/testrepo".format(
+ password),
+ to_path=rw_dir)
+ except GitCommandError as err:
+ assert password not in str(err), "The error message '%s' should not contain the password" % err
+ # Working example from a blank private project
+ Repo.clone_from(
+ url="https://gitlab+deploy-token-392045:mLWhVus7bjLsy8xj8q2V@gitlab.com/mercierm/test_git_python",
+ to_path=rw_dir)
+
@with_rw_repo('HEAD')
def test_max_chunk_size(self, repo):
class TestOutputStream(TestBase):