Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean_facts only show variable name #76974

Merged
merged 1 commit into from Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/clean_facts_values.yml
@@ -0,0 +1,2 @@
bugfixes:
- cleaning facts will now only warn about the variable name and not post the content, which can be undesireable to disclose
8 changes: 1 addition & 7 deletions lib/ansible/vars/clean.py
Expand Up @@ -152,13 +152,7 @@ def clean_facts(facts):
# then we remove them (except for ssh host keys)
for r_key in remove_keys:
if not r_key.startswith('ansible_ssh_host_key_'):
try:
r_val = to_text(data[r_key])
if len(r_val) > 24:
r_val = '%s ... %s' % (r_val[:13], r_val[-6:])
except Exception:
r_val = ' <failed to convert value to a string> '
display.warning("Removed restricted key from module data: %s = %s" % (r_key, r_val))
display.warning("Removed restricted key from module data: %s" % (r_key))
del data[r_key]

return strip_internal_keys(data)
Expand Down