Merge "Mask encryption_key_id"

This commit is contained in:
Zuul 2019-03-27 16:19:40 +00:00 committed by Gerrit Code Review
commit 895062f3af
2 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,8 @@ SLUGIFY_HYPHENATE_RE = re.compile(r"[-\s]+")
_SANITIZE_KEYS = ['adminPass', 'admin_pass', 'password', 'admin_password', _SANITIZE_KEYS = ['adminPass', 'admin_pass', 'password', 'admin_password',
'auth_token', 'new_pass', 'auth_password', 'secret_uuid', 'auth_token', 'new_pass', 'auth_password', 'secret_uuid',
'secret', 'sys_pswd', 'token', 'configdrive', 'secret', 'sys_pswd', 'token', 'configdrive',
'CHAPPASSWORD', 'encrypted_key', 'private_key'] 'CHAPPASSWORD', 'encrypted_key', 'private_key',
'encryption_key_id']
# NOTE(ldbragst): Let's build a list of regex objects using the list of # NOTE(ldbragst): Let's build a list of regex objects using the list of
# _SANITIZE_KEYS we already have. This way, we only have to add the new key # _SANITIZE_KEYS we already have. This way, we only have to add the new key

View File

@ -459,6 +459,9 @@ class MaskPasswordTestCase(test_base.BaseTestCase):
payload = """body: {"rescue": {"password": "1234567"}}""" payload = """body: {"rescue": {"password": "1234567"}}"""
expected = """body: {"rescue": {"password": "***"}}""" expected = """body: {"rescue": {"password": "***"}}"""
self.assertEqual(expected, strutils.mask_password(payload)) self.assertEqual(expected, strutils.mask_password(payload))
payload = """body: {"rescue": {"encryption_key_id": "1234567"}}"""
expected = """body: {"rescue": {"encryption_key_id": "***"}}"""
self.assertEqual(expected, strutils.mask_password(payload))
def test_xml_message(self): def test_xml_message(self):
payload = """<?xml version="1.0" encoding="UTF-8"?> payload = """<?xml version="1.0" encoding="UTF-8"?>