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: #3766
Relevant: #3736

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
  • Loading branch information
pmoravec committed Sep 24, 2024
1 parent 3886534 commit a9b0161
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 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
IPV6_REG_4HEX = (
r'((?<!([0-9a-fA-F\'\"]:)|::)(([^:\-]?[0-9a-fA-F]{4}(:|-)){3}'
r'[0-9a-fA-F]{4}(\'|\")?(\/|\,|\-|\.|\s|$)))'
# - but disallow "substrings"
# - but allow fe80: or fe80:: prefix for link-local
IPV6_REG_4HEX_NEW = (
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 a9b0161

Please sign in to comment.