本文整理汇总了Python中sentry.utils.data_scrubber.SensitiveDataFilter.apply方法的典型用法代码示例。如果您正苦于以下问题:Python SensitiveDataFilter.apply方法的具体用法?Python SensitiveDataFilter.apply怎么用?Python SensitiveDataFilter.apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentry.utils.data_scrubber.SensitiveDataFilter
的用法示例。
在下文中一共展示了SensitiveDataFilter.apply方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_querystring_as_pairlist
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
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],
]
示例2: test_extra
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
def test_extra(self):
data = {'extra': VARS}
proc = SensitiveDataFilter()
proc.apply(data)
assert 'extra' in data
self._check_vars_sanitized(data['extra'], proc)
示例3: test_extra
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
def test_extra(self):
data = {"extra": VARS}
proc = SensitiveDataFilter()
proc.apply(data)
self.assertTrue("extra" in data)
self._check_vars_sanitized(data["extra"], proc)
示例4: test_querystring_as_string_with_partials
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
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))
示例5: test_does_sanitize_public_key
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
def test_does_sanitize_public_key(self):
data = {
'extra': {
's': PUBLIC_KEY,
},
}
proc = SensitiveDataFilter()
proc.apply(data)
assert data['extra'] == {'s': FILTER_MASK}
示例6: test_does_sanitize_rsa_private_key
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
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}
示例7: test_does_sanitize_social_security_number
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
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}
示例8: test_exclude_fields_on_field_name
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
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'}
示例9: test_explicit_fields
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
def test_explicit_fields(self):
data = {
'extra': {
'mystuff': 'xxx',
},
}
proc = SensitiveDataFilter(fields=['mystuff'])
proc.apply(data)
assert data['extra']['mystuff'] == FILTER_MASK
示例10: test_exclude_fields_on_field_value
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
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'}
示例11: test_empty_field
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
def test_empty_field(self):
data = {
'extra': {
'foobar': 'xxx',
},
}
proc = SensitiveDataFilter(fields=[''])
proc.apply(data)
assert data['extra'] == {'foobar': 'xxx'}
示例12: test_does_not_fail_on_non_string
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
def test_does_not_fail_on_non_string(self):
data = {
'extra': {
'foo': 1,
},
}
proc = SensitiveDataFilter()
proc.apply(data)
assert data['extra'] == {'foo': 1}
示例13: test_http
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
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)
示例14: test_sanitize_additional_sensitive_fields
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
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)
示例15: test_sanitize_http_body
# 需要导入模块: from sentry.utils.data_scrubber import SensitiveDataFilter [as 别名]
# 或者: from sentry.utils.data_scrubber.SensitiveDataFilter import apply [as 别名]
def test_sanitize_http_body(self):
data = {
'sentry.interfaces.Http': {
'data': '{"email":"[email protected]","password":"zzzzz"}',
},
}
proc = SensitiveDataFilter()
proc.apply(data)
self.assertTrue('sentry.interfaces.Http' in data)
http = data['sentry.interfaces.Http']
self.assertEquals(http['data'], FILTER_MASK)