diff --git a/changelogs/fragments/5934-fix-keycloak-sanitize_cr.yml b/changelogs/fragments/5934-fix-keycloak-sanitize_cr.yml new file mode 100644 index 0000000000..1c3163023c --- /dev/null +++ b/changelogs/fragments/5934-fix-keycloak-sanitize_cr.yml @@ -0,0 +1,2 @@ +bugfixes: + - "keycloak_client - fix accidental replacement of value for attribute ``saml.signing.private.key`` with ``no_log`` in wrong contexts (https://github.com/ansible-collections/community.general/pull/5934)." \ No newline at end of file diff --git a/plugins/modules/keycloak_client.py b/plugins/modules/keycloak_client.py index 22ba6a810a..51e516221b 100644 --- a/plugins/modules/keycloak_client.py +++ b/plugins/modules/keycloak_client.py @@ -712,6 +712,7 @@ end_state: from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, camel, \ keycloak_argument_spec, get_token, KeycloakError from ansible.module_utils.basic import AnsibleModule +import copy def normalise_cr(clientrep, remove_ids=False): @@ -750,7 +751,7 @@ def sanitize_cr(clientrep): :param clientrep: the clientrep dict to be sanitized :return: sanitized clientrep dict """ - result = clientrep.copy() + result = copy.deepcopy(clientrep) if 'secret' in result: result['secret'] = 'no_log' if 'attributes' in result: