本文整理汇总了Python中sentry.utils.data_scrubber.SensitiveDataFilter类的典型用法代码示例。如果您正苦于以下问题:Python SensitiveDataFilter类的具体用法?Python SensitiveDataFilter怎么用?Python SensitiveDataFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SensitiveDataFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_querystring_as_pairlist
def test_querystring_as_pairlist(self):
data = {
'request': {
'query_string': [
['foo', 'bar'],
['password', 'hello'],
['the_secret', 'hello'],
['a_password_here', 'hello'],
['api_key', 'secret_key'],
],
}
}
proc = SensitiveDataFilter()
proc.apply(data)
assert 'request' in data
http = data['request']
assert http['query_string'] == [
['foo', 'bar'],
['password', FILTER_MASK],
['the_secret', FILTER_MASK],
['a_password_here', FILTER_MASK],
['api_key', FILTER_MASK],
]
开发者ID:yaoqi,项目名称:sentry,代码行数:25,代码来源:test_data_scrubber.py
示例2: test_extra
def test_extra(self):
data = {'extra': VARS}
proc = SensitiveDataFilter()
proc.apply(data)
assert 'extra' in data
self._check_vars_sanitized(data['extra'], proc)
开发者ID:alexandrul,项目名称:sentry,代码行数:8,代码来源:test_data_scrubber.py
示例3: test_extra
def test_extra(self):
data = {"extra": VARS}
proc = SensitiveDataFilter()
proc.apply(data)
self.assertTrue("extra" in data)
self._check_vars_sanitized(data["extra"], proc)
开发者ID:BlueMoebius,项目名称:sentry,代码行数:8,代码来源:test_data_scrubber.py
示例4: test_sanitize_credit_card_within_value
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
开发者ID:alexandrul,项目名称:sentry,代码行数:8,代码来源:test_data_scrubber.py
示例5: test_sanitize_credit_card_within_value
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)
开发者ID:Natim,项目名称:sentry,代码行数:8,代码来源:test_data_scrubber.py
示例6: test_sanitize_url
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')
开发者ID:Natim,项目名称:sentry,代码行数:9,代码来源:test_data_scrubber.py
示例7: test_querystring_as_string_with_partials
def test_querystring_as_string_with_partials(self):
data = {"request": {"query_string": "foo=bar&password&baz=bar"}}
proc = SensitiveDataFilter()
proc.apply(data)
self.assertTrue("request" in data)
http = data["request"]
self.assertEquals(http["query_string"], "foo=bar&password&baz=bar" % dict(m=proc.MASK))
开发者ID:BlueMoebius,项目名称:sentry,代码行数:9,代码来源:test_data_scrubber.py
示例8: test_does_not_fail_on_non_string
def test_does_not_fail_on_non_string(self):
data = {
'extra': {
'foo': 1,
},
}
proc = SensitiveDataFilter()
result = proc.apply(data)
self.assertEquals(data['extra'], {'foo': 1})
开发者ID:Natim,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例9: test_does_sanitize_public_key
def test_does_sanitize_public_key(self):
data = {
'extra': {
's': PUBLIC_KEY,
},
}
proc = SensitiveDataFilter()
proc.apply(data)
assert data['extra'] == {'s': FILTER_MASK}
开发者ID:alexandrul,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例10: test_exclude_fields_on_field_name
def test_exclude_fields_on_field_name(self):
data = {
'extra': {
'password': '123-45-6789',
},
}
proc = SensitiveDataFilter(exclude_fields=['password'])
proc.apply(data)
assert data['extra'] == {'password': '123-45-6789'}
开发者ID:alexandrul,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例11: test_does_not_fail_on_non_string
def test_does_not_fail_on_non_string(self):
data = {
'extra': {
'foo': 1,
},
}
proc = SensitiveDataFilter()
proc.apply(data)
assert data['extra'] == {'foo': 1}
开发者ID:alexandrul,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例12: test_exclude_fields_on_field_value
def test_exclude_fields_on_field_value(self):
data = {
'extra': {
'foobar': '123-45-6789',
},
}
proc = SensitiveDataFilter(exclude_fields=['foobar'])
proc.apply(data)
assert data['extra'] == {'foobar': '123-45-6789'}
开发者ID:alexandrul,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例13: test_explicit_fields
def test_explicit_fields(self):
data = {
'extra': {
'mystuff': 'xxx',
},
}
proc = SensitiveDataFilter(fields=['mystuff'])
proc.apply(data)
assert data['extra']['mystuff'] == FILTER_MASK
开发者ID:alexandrul,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例14: test_empty_field
def test_empty_field(self):
data = {
'extra': {
'foobar': 'xxx',
},
}
proc = SensitiveDataFilter(fields=[''])
proc.apply(data)
assert data['extra'] == {'foobar': 'xxx'}
开发者ID:alexandrul,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例15: test_does_sanitize_rsa_private_key
def test_does_sanitize_rsa_private_key(self):
data = {
'extra': {
's': RSA_PRIVATE_KEY,
},
}
proc = SensitiveDataFilter()
proc.apply(data)
assert data['extra'] == {'s': FILTER_MASK}
开发者ID:alexandrul,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例16: test_does_sanitize_social_security_number
def test_does_sanitize_social_security_number(self):
data = {
'extra': {
's': '123-45-6789',
},
}
proc = SensitiveDataFilter()
proc.apply(data)
assert data['extra'] == {'s': FILTER_MASK}
开发者ID:alexandrul,项目名称:sentry,代码行数:10,代码来源:test_data_scrubber.py
示例17: test_http
def test_http(self):
data = {"request": {"data": VARS, "env": VARS, "headers": VARS, "cookies": VARS}}
proc = SensitiveDataFilter()
proc.apply(data)
self.assertTrue("request" in data)
http = data["request"]
for n in ("data", "env", "headers", "cookies"):
self.assertTrue(n in http)
self._check_vars_sanitized(http[n], proc)
开发者ID:BlueMoebius,项目名称:sentry,代码行数:11,代码来源:test_data_scrubber.py
示例18: test_sanitize_additional_sensitive_fields
def test_sanitize_additional_sensitive_fields(self):
additional_sensitive_dict = {'fieldy_field': 'value', 'moar_other_field': 'another value'}
data = {'extra': dict(list(VARS.items()) + list(additional_sensitive_dict.items()))}
proc = SensitiveDataFilter(additional_sensitive_dict.keys())
proc.apply(data)
for field in additional_sensitive_dict.keys():
assert data['extra'][field] == FILTER_MASK
self._check_vars_sanitized(data['extra'], proc)
开发者ID:alexandrul,项目名称:sentry,代码行数:11,代码来源:test_data_scrubber.py
示例19: test_sanitize_http_body
def test_sanitize_http_body(self):
data = {
'sentry.interfaces.Http': {
'data': '{"email":"[email protected]","password":"zzzzz"}',
},
}
proc = SensitiveDataFilter()
proc.apply(data)
assert 'sentry.interfaces.Http' in data
http = data['sentry.interfaces.Http']
assert http['data'] == FILTER_MASK
开发者ID:alexandrul,项目名称:sentry,代码行数:12,代码来源:test_data_scrubber.py
示例20: test_sanitize_http_body
def test_sanitize_http_body(self):
data = {
'sentry.interfaces.Http': {
'data': '{"email":"[email protected]","password":"zzzzz"}',
},
}
proc = SensitiveDataFilter()
result = proc.apply(data)
self.assertTrue('sentry.interfaces.Http' in data)
http = data['sentry.interfaces.Http']
self.assertEquals(http['data'], proc.MASK)
开发者ID:Natim,项目名称:sentry,代码行数:12,代码来源:test_data_scrubber.py
注:本文中的sentry.utils.data_scrubber.SensitiveDataFilter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论