From 7b84e8a75eaafbb9f9e07cd6da1ef09f1bbf7896 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Sun, 28 Jan 2024 14:54:46 +0100 Subject: [cleaner] Skip obfuscation for short strings in some mappings Obfuscation of entries like "map" or "po" is redundant and rather causes user confusion and longer cleaner run. Stop obfuscating those strings in relevant mappings (only). Relevant: #3403 Signed-off-by: Pavel Moravec --- sos/cleaner/mappings/__init__.py | 4 +++- sos/cleaner/mappings/hostname_map.py | 1 + sos/cleaner/mappings/username_map.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sos/cleaner/mappings/__init__.py b/sos/cleaner/mappings/__init__.py index 1cb41a43..b56ced40 100644 --- a/sos/cleaner/mappings/__init__.py +++ b/sos/cleaner/mappings/__init__.py @@ -25,6 +25,7 @@ class SoSMap(): # used for filename obfuscations in parser.parse_string_for_keys() skip_keys = [] compile_regexes = True + ignore_short_items = False def __init__(self): self.dataset = {} @@ -36,7 +37,8 @@ class SoSMap(): """Some items need to be completely ignored, for example link-local or loopback addresses should not be obfuscated """ - if not item or item in self.skip_keys or item in self.dataset.values(): + if not item or item in self.skip_keys or item in self.dataset.values()\ + or (self.ignore_short_items and len(item) <= 3): return True for skip in self.ignore_matches: if re.match(skip, item, re.I): diff --git a/sos/cleaner/mappings/hostname_map.py b/sos/cleaner/mappings/hostname_map.py index 7bbf1529..ca26125c 100644 --- a/sos/cleaner/mappings/hostname_map.py +++ b/sos/cleaner/mappings/hostname_map.py @@ -43,6 +43,7 @@ class SoSHostnameMap(SoSMap): strip_exts = ('.yaml', '.yml', '.crt', '.key', '.pem', '.log', '.repo', '.rules', '.conf', '.cfg') + ignore_short_items = True host_count = 0 domain_count = 0 _domains = {} diff --git a/sos/cleaner/mappings/username_map.py b/sos/cleaner/mappings/username_map.py index db12e788..e1ef026c 100644 --- a/sos/cleaner/mappings/username_map.py +++ b/sos/cleaner/mappings/username_map.py @@ -20,6 +20,7 @@ class SoSUsernameMap(SoSMap): Note that this specifically obfuscates user_names_ and not UIDs. """ + ignore_short_items = True name_count = 0 def sanitize_item(self, username): -- cgit