Skip to content

Commit

Permalink
[cleaner] Improve IPV6 MAC address RE
Browse files Browse the repository at this point in the history
Current RE obfuscates also UUID strings, let be more strict.

Resolves: sosreport#3766
Relevant: sosreport#3736

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
  • Loading branch information
pmoravec committed Sep 24, 2024
1 parent 3886534 commit cc91383
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sos/cleaner/parsers/mac_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
r'[0-9a-fA-F]{2}(\'|\")?(\/|\,|\-|\.|\s|$))'
)
# aabb:ccee:ddee:ffaa
# - but disallow "substrings"
# - but allow fe80: or fe80:: prefix for link-local
IPV6_REG_4HEX = (
r'((?<!([0-9a-fA-F\'\"]:)|::)(([^:\-]?[0-9a-fA-F]{4}(:|-)){3}'
r'[0-9a-fA-F]{4}(\'|\")?(\/|\,|\-|\.|\s|$)))'
r'((?<!(?:([.|^|\b]{5}\w|[.|^|\b]fe80:|fe80::)))'
r'(([0-9a-fA-F]{4}:){3}[0-9a-fA-F]{4})(?!\w))|'
r'((?<!\w)(([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{4})(?!\w))'
)
# aa:bb:cc:dd:ee:ff avoiding ipv6 substring matches
IPV4_REG = (
Expand Down

0 comments on commit cc91383

Please sign in to comment.