|
2 | 2 |
|
3 | 3 | """
|
4 | 4 |
|
5 |
| -Filter to anonyimize email addresses. It reads input line by line, |
| 5 | +Filter to anonymize email addresses. It reads input line by line, |
6 | 6 | finds all emails in the input and masks them using given filter.
|
7 | 7 |
|
8 | 8 | Big thanks to [Sergio Del Río Mayoral](https://github.com/sdelrio)
|
|
26 | 26 | # BIG FAT NOTICE on emails and regular expressions:
|
27 | 27 | # If you're planning on using a regular expression to validate an email: don't. Emails
|
28 | 28 | # are much more complex than you would imagine and most regular expressions will not
|
29 |
| -# cover all usecases. Newer RFCs even allow for international (read: UTF-8) email addresses. |
30 |
| -# Most of your favourite programming languages will have a dedicated library for validating |
| 29 | +# cover all use cases. Newer RFCs even allow for international (read: UTF-8) email addresses. |
| 30 | +# Most of your favorite programming languages will have a dedicated library for validating |
31 | 31 | # addresses.
|
32 | 32 | #
|
33 | 33 | # This pattern below, should, however match anything that remotely looks like an email.
|
@@ -85,7 +85,7 @@ def is_message_id(self, match: re.match, msg: str) -> bool:
|
85 | 85 | start = match.start()
|
86 | 86 | email = match.group()
|
87 | 87 |
|
88 |
| - # Note that our regex will match thigs like "message-id=Issue1649523226559@postfix-mail.mail-system.svc.cluster.local" |
| 88 | + # Note that our regex will match things like "message-id=Issue1649523226559@postfix-mail.mail-system.svc.cluster.local" |
89 | 89 | # so we need to filter / check for these first
|
90 | 90 |
|
91 | 91 | if email.startswith(self.MESSAGE_ID_LINE):
|
@@ -123,9 +123,9 @@ def processMessage(self, msg: str) -> typing.Optional[str]:
|
123 | 123 | """
|
124 | 124 | This filter will take an educated guess at how to best mask the emails, specifically:
|
125 | 125 |
|
126 |
| -* It will leave the first and the last letter of the local part (if it's oly one letter, it will get repated) |
| 126 | +* It will leave the first and the last letter of the local part (if it's oly one letter, it will get repeated) |
127 | 127 | * If the local part is in quotes, it will remove the quotes (Warning: if the email starts with a space, this might look weird in logs)
|
128 |
| -* It will replace all the letters inbetween with **ONE** asterisk |
| 128 | +* It will replace all the letters in between with **ONE** asterisk |
129 | 129 | * It will replace everything but a TLD with a star
|
130 | 130 | * Address-style domains will see the number replaced with stars
|
131 | 131 |
|
|
0 commit comments