ansible/test/integration/targets/module_utils/library/test_no_log.py
Jordan Borean 0cdc410dce
no_log mask suboption fallback values and defaults CVE-2021-20228 (#73487)
* no_log mask suboption fallback values and defaults

* Added changelog

* Remove lambda expression
2021-02-05 09:11:55 +10:00

35 lines
1.2 KiB
Python

#!/usr/bin/python
# (c) 2021 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule, env_fallback
def main():
module = AnsibleModule(
argument_spec=dict(
explicit_pass=dict(type='str', no_log=True),
fallback_pass=dict(type='str', no_log=True, fallback=(env_fallback, ['SECRET_ENV'])),
default_pass=dict(type='str', no_log=True, default='zyx'),
normal=dict(type='str', default='plaintext'),
suboption=dict(
type='dict',
options=dict(
explicit_sub_pass=dict(type='str', no_log=True),
fallback_sub_pass=dict(type='str', no_log=True, fallback=(env_fallback, ['SECRET_SUB_ENV'])),
default_sub_pass=dict(type='str', no_log=True, default='xvu'),
normal=dict(type='str', default='plaintext'),
),
),
),
)
module.exit_json(changed=False)
if __name__ == '__main__':
main()