mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-11 07:42:20 -05:00
merge from main
This commit is contained in:
13
app/utils.py
13
app/utils.py
@@ -1,4 +1,3 @@
|
||||
import re
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from flask import url_for
|
||||
@@ -145,15 +144,3 @@ def naive_utcnow():
|
||||
|
||||
def utc_now():
|
||||
return naive_utcnow()
|
||||
|
||||
|
||||
def scrub(msg):
|
||||
# Eventually we want to scrub all messages in all logs for phone numbers
|
||||
# and email addresses, masking them. Ultimately this will probably get
|
||||
# refactored into a 'SafeLogger' subclass or something, but let's start here
|
||||
# with phones.
|
||||
phones = re.findall("(?:\\+ *)?\\d[\\d\\- ]{7,}\\d", msg)
|
||||
phones = [phone.replace("-", "").replace(" ", "") for phone in phones]
|
||||
for phone in phones:
|
||||
msg = msg.replace(phone, f"1XXXXX{phone[-5:]}")
|
||||
return msg
|
||||
|
||||
Reference in New Issue
Block a user