diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2020-07-24 21:53:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-24 21:53:17 +0200 |
commit | 1223ce656aa3b44d7e6d9b8d9460d3ae63b09fdc (patch) | |
tree | 7f80fae270ba9306051fc77ebda979afdfd4968e /test/units/utils | |
parent | Update the number of contributors in README: 5000+ (#70880) (diff) | |
download | ansible-1223ce656aa3b44d7e6d9b8d9460d3ae63b09fdc.tar.xz ansible-1223ce656aa3b44d7e6d9b8d9460d3ae63b09fdc.zip |
reset logging to INFO (#70878)
- due to CVE-2019-14846
- also added comments and test to avoid 'oportunistic' reversion
Diffstat (limited to 'test/units/utils')
-rw-r--r-- | test/units/utils/display/test_logger.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/units/utils/display/test_logger.py b/test/units/utils/display/test_logger.py new file mode 100644 index 0000000000..ed69393bdf --- /dev/null +++ b/test/units/utils/display/test_logger.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020 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 + + +import logging +import sys + + +def test_logger(): + ''' + Avoid CVE-2019-14846 as 3rd party libs will disclose secrets when + logging is set to DEBUG + ''' + + # clear loaded modules to have unadultered test. + for loaded in list(sys.modules.keys()): + if 'ansible' in loaded: + del sys.modules[loaded] + + # force logger to exist via config + from ansible import constants as C + C.DEFAULT_LOG_PATH = '/dev/null' + + # initialize logger + from ansible.utils.display import logger + + assert logger.root.level != logging.DEBUG |