Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add single quotes around username/password to credentials helper #171

Merged
merged 1 commit into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions gitopscli/git_api/git_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __create_credentials_file(self, username: str, password: str) -> str:
file_path = f"{self.__tmp_dir}/credentials.sh"
with open(file_path, "w") as text_file:
text_file.write("#!/bin/sh\n")
text_file.write(f"echo username={username}\n")
text_file.write(f"echo password={password}\n")
text_file.write(f"echo username='{username}'\n")
text_file.write(f"echo password='{password}'\n")
os.chmod(file_path, 0o700)
return file_path
4 changes: 2 additions & 2 deletions tests/git_api/test_git_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def test_clone_with_credentials(self, logging_mock):
self.assertEqual(
"""\
#!/bin/sh
echo username=User
echo password=Pass
echo username='User'
echo password='Pass'
""",
credentials_file,
)
Expand Down