Skip to content

Commit

Permalink
Switch from "X" to "*" for passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Apr 3, 2024
1 parent 412533a commit dafcf31
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Changed

* Change from `X` to `*` for password when showing them

## 1.6.1 - 2023-07-06

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion qgis_plugin_manager/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,6 @@ def public_remote_name(cls, server: str) -> str:
u = urlparse(server)
query = parse_qs(u.query, keep_blank_values=True)
if 'password' in query.keys():
query['password'] = 'XXXXX'
query['password'] = '******'
u = u._replace(query=urlencode(query, True))
return urlunparse(u)
5 changes: 4 additions & 1 deletion test/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,17 @@ def test_parse_url(self):

def test_clean_remote(self):
""" Test to clean a URL from login&password. """
# "password", the keyword to look for
self.assertEqual(
"https://foo.bar/plugins.xml?qgis=3.10&username=login&password=XXXXX",
"https://foo.bar/plugins.xml?qgis=3.10&username=login&password=%2A%2A%2A%2A%2A%2A",
Remote.public_remote_name("https://foo.bar/plugins.xml?qgis=3.10&username=login&password=pass")
)
# "pass", not the keyword to look for
self.assertEqual(
"https://foo.bar/plugins.xml?qgis=3.10&username=login&pass=pass",
Remote.public_remote_name("https://foo.bar/plugins.xml?qgis=3.10&username=login&pass=pass")
)
# Nothing
self.assertEqual(
"https://foo.bar/plugins.xml?qgis=3.10",
Remote.public_remote_name("https://foo.bar/plugins.xml?qgis=3.10")
Expand Down

0 comments on commit dafcf31

Please sign in to comment.