Skip to content

Commit

Permalink
[cleaner] Check if keyword exists in dataset before obfuscation
Browse files Browse the repository at this point in the history
Check whether item keyword exists in dataset before obfuscation
in sanitize_item(self, item) method. Resolves redundant increments
when the same keyword is provided more than once, and the current
obfuscation "obfuscatedwordX" is preserved.

Closes: sosreport#3745

Signed-off-by: swarajpande5 <[email protected]>
  • Loading branch information
swarajpande5 authored and TurboTurtle committed Aug 26, 2024
1 parent 9aaf5ca commit 8b0d86f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sos/cleaner/mappings/keyword_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class SoSKeywordMap(SoSMap):
word_count = 0

def sanitize_item(self, item):
if item in self.dataset:
return self.dataset[item]
_ob_item = f"obfuscatedword{self.word_count}"
self.word_count += 1
if _ob_item in self.dataset.values():
Expand Down

0 comments on commit 8b0d86f

Please sign in to comment.