mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
Ensure heuristic_log_sanitize returns correct data if no password found (#75570)
* Ensure heuristic_log_sanitize returns correct data if no password found. See #75542 * Need to allow code to flow through
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
bugfixes:
|
||||
- >
|
||||
``heuristic_log_sanitize`` - Return the full string if there is no password (https://github.com/ansible/ansible/issues/75542)
|
||||
@@ -350,7 +350,7 @@ def heuristic_log_sanitize(data, no_log_values=None):
|
||||
if begin == 0:
|
||||
# Searched the whole string so there's no password
|
||||
# here. Return the remaining data
|
||||
output.insert(0, data[0:begin])
|
||||
output.insert(0, data[0:prev_begin])
|
||||
break
|
||||
# Search for a different beginning of the password field.
|
||||
sep_search_end = begin
|
||||
|
||||
@@ -87,3 +87,6 @@ class TestHeuristicLogSanitize(unittest.TestCase):
|
||||
def test_hides_parameter_secrets(self):
|
||||
output = heuristic_log_sanitize('token="secret", user="person", token_entry="test=secret"', frozenset(['secret']))
|
||||
self.assertNotIn('secret', output)
|
||||
|
||||
def test_no_password(self):
|
||||
self.assertEqual(heuristic_log_sanitize('foo@bar'), 'foo@bar')
|
||||
|
||||
Reference in New Issue
Block a user