mirror of
https://github.com/ansible/awx.git
synced 2026-04-07 02:59:21 -02:30
redact survey password type values w/ tests
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import re
|
||||
import urlparse
|
||||
|
||||
REPLACE_STR = '$encrypted$'
|
||||
|
||||
class UriCleaner(object):
|
||||
REPLACE_STR = '$encrypted$'
|
||||
REPLACE_STR = REPLACE_STR
|
||||
# https://regex101.com/r/sV2dO2/2
|
||||
SENSITIVE_URI_PATTERN = re.compile(ur'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))', re.MULTILINE)
|
||||
|
||||
@@ -51,4 +53,9 @@ class UriCleaner(object):
|
||||
|
||||
return redactedtext
|
||||
|
||||
class PlainTextCleaner(object):
|
||||
REPLACE_STR = REPLACE_STR
|
||||
|
||||
@staticmethod
|
||||
def remove_sensitive(cleartext, sensitive):
|
||||
return re.sub(r'%s' % re.escape(sensitive), '$encrypted$', cleartext)
|
||||
|
||||
Reference in New Issue
Block a user