本文整理汇总了Python中sentry.utils.data_scrubber.SensitiveDataFilter.sanitize方法的典型用法代码示例。如果您正苦于以下问题:Python SensitiveDataFilter.sanitize方法的具体用法?Python SensitiveDataFilter.sanitize怎么用?Python SensitiveDataFilter.sanitize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentry.utils.data_scrubber.SensitiveDataFilter
的用法示例。
在下文中一共展示了SensitiveDataFilter.sanitize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sanitize_credit_card_within_value
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_credit_card_within_value(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', "'4242424242424242'")
self.assertEquals(result, proc.MASK)
proc = SensitiveDataFilter()
result = proc.sanitize('foo', "foo 4242424242424242")
self.assertEquals(result, proc.MASK)
示例2: test_sanitize_credit_card_within_value
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_credit_card_within_value(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', "'4571234567890111'")
assert result == FILTER_MASK
proc = SensitiveDataFilter()
result = proc.sanitize('foo', "foo 4571234567890111")
assert result == FILTER_MASK
示例3: test_sanitize_url
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_url(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', 'pg://matt:[email protected]/1')
self.assertEquals(result, 'pg://matt:%[email protected]/1' % proc.MASK)
# Make sure we don't mess up any other url.
# This url specifically if passed through urlunsplit(urlsplit()),
# it'll change the value.
result = proc.sanitize('foo', 'postgres:///path')
self.assertEquals(result, 'postgres:///path')
示例4: test_sanitize_url
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_url(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', 'pg://matt:[email protected]/1')
assert result == 'pg://matt:%[email protected]/1' % FILTER_MASK
result = proc.sanitize('foo', "foo 'redis://redis:[email protected]:6379/0' bar")
assert result == "foo 'redis://redis:%[email protected]:6379/0' bar" % FILTER_MASK
result = proc.sanitize('foo', "'redis://redis:[email protected]:6379/0'")
assert result == "'redis://redis:%[email protected]:6379/0'" % FILTER_MASK
result = proc.sanitize('foo', "foo redis://redis:[email protected]:6379/0 bar")
assert result == "foo redis://redis:%[email protected]:6379/0 bar" % FILTER_MASK
result = proc.sanitize(
'foo', "foo redis://redis:[email protected]:6379/0 bar pg://matt:[email protected]/1"
)
assert result == "foo redis://redis:%[email protected]:6379/0 bar pg://matt:%[email protected]/1" % (
FILTER_MASK, FILTER_MASK
)
# Make sure we don't mess up any other url.
# This url specifically if passed through urlunsplit(urlsplit()),
# it'll change the value.
result = proc.sanitize('foo', 'postgres:///path')
assert result == 'postgres:///path'
# Don't be too overly eager within JSON strings an catch the right field.
result = proc.sanitize(
'foo',
'{"a":"https://localhost","b":"[email protected]","c":"pg://matt:[email protected]/1","d":"lol"}'
)
assert result == '{"a":"https://localhost","b":"[email protected]","c":"pg://matt:%[email protected]/1","d":"lol"}' % FILTER_MASK
示例5: test_sanitize_url
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_url(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', 'pg://matt:[email protected]/1')
self.assertEquals(result, 'pg://matt:%[email protected]/1' % FILTER_MASK)
# Make sure we don't mess up any other url.
# This url specifically if passed through urlunsplit(urlsplit()),
# it'll change the value.
result = proc.sanitize('foo', 'postgres:///path')
self.assertEquals(result, 'postgres:///path')
result = proc.sanitize('foo', "foo 'redis://redis:[email protected]:6379/0' bar")
self.assertEquals(result, "foo 'redis://redis:%[email protected]:6379/0' bar" % FILTER_MASK)
result = proc.sanitize('foo', "'redis://redis:[email protected]:6379/0'")
self.assertEquals(result, "'redis://redis:%[email protected]:6379/0'" % FILTER_MASK)
result = proc.sanitize('foo', "foo redis://redis:[email protected]:6379/0 bar")
self.assertEquals(result, "foo redis://redis:%[email protected]:6379/0 bar" % FILTER_MASK)
result = proc.sanitize('foo', "foo redis://redis:[email protected]:6379/0 bar pg://matt:[email protected]/1")
self.assertEquals(result, "foo redis://redis:%[email protected]:6379/0 bar pg://matt:%[email protected]/1" % (FILTER_MASK, FILTER_MASK))
示例6: test_sanitize_credit_card_amex
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_credit_card_amex(self):
# AMEX numbers are 15 digits, not 16
proc = SensitiveDataFilter()
result = proc.sanitize('foo', '424242424242424')
self.assertEquals(result, proc.MASK)
示例7: test_sanitize_credit_card
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_credit_card(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', '4242424242424242')
self.assertEquals(result, proc.MASK)
示例8: test_doesnt_scrub_not_scrubbed
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_doesnt_scrub_not_scrubbed(self):
proc = SensitiveDataFilter(include_defaults=True)
assert proc.sanitize('is_authenticated', 'foobar') == FILTER_MASK
assert proc.sanitize('is_authenticated', 'null') == 'null'
assert proc.sanitize('is_authenticated', True) is True
示例9: test_authorization_scrubbing
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_authorization_scrubbing(self):
proc = SensitiveDataFilter(include_defaults=True)
assert proc.sanitize('authorization', 'foobar') == FILTER_MASK
assert proc.sanitize('auth', 'foobar') == FILTER_MASK
assert proc.sanitize('auXth', 'foobar') == 'foobar'
示例10: test_should_have_mysql_pwd_as_a_default
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_should_have_mysql_pwd_as_a_default(self):
proc = SensitiveDataFilter(include_defaults=True)
assert proc.sanitize('MYSQL_PWD', 'the one') == FILTER_MASK
assert proc.sanitize('mysql_pwd', 'the two') == FILTER_MASK
示例11: test_does_not_sanitize_timestamp_looks_like_card
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_does_not_sanitize_timestamp_looks_like_card(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', '1453843029218310')
assert result == '1453843029218310'
示例12: test_sanitize_credit_card_mastercard
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_credit_card_mastercard(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', '5555555555554444')
assert result == FILTER_MASK
示例13: test_sanitize_credit_card_visa
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_credit_card_visa(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', '4111111111111111')
assert result == FILTER_MASK
示例14: test_sanitize_credit_card_discover
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_credit_card_discover(self):
proc = SensitiveDataFilter()
result = proc.sanitize('foo', '6011111111111117')
assert result == FILTER_MASK
示例15: test_sanitize_credit_card_amex
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import sanitize [as 别名]
def test_sanitize_credit_card_amex(self):
# AMEX numbers are 15 digits, not 16
proc = SensitiveDataFilter()
result = proc.sanitize('foo', '378282246310005')
assert result == FILTER_MASK