本文整理汇总了Python中raven.processors.SanitizePasswordsProcessor类的典型用法代码示例。如果您正苦于以下问题:Python SanitizePasswordsProcessor类的具体用法?Python SanitizePasswordsProcessor怎么用?Python SanitizePasswordsProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SanitizePasswordsProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stacktrace
def test_stacktrace(self):
data = {
'sentry.interfaces.Stacktrace': {
'frames': [
{
'vars': {
'foo': 'bar',
'password': 'hello',
'the_secret': 'hello',
'a_password_here': 'hello',
},
}
]
}
}
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('sentry.interfaces.Stacktrace' in result)
stack = result['sentry.interfaces.Stacktrace']
self.assertTrue('frames' in stack)
self.assertEquals(len(stack['frames']), 1)
frame = stack['frames'][0]
self.assertTrue('vars' in frame)
vars = frame['vars']
self.assertTrue('foo' in vars)
self.assertEquals(vars['foo'], 'bar')
self.assertTrue('password' in vars)
self.assertEquals(vars['password'], proc.MASK)
self.assertTrue('the_secret' in vars)
self.assertEquals(vars['the_secret'], proc.MASK)
self.assertTrue('a_password_here' in vars)
self.assertEquals(vars['a_password_here'], proc.MASK)
示例2: test_extra
def test_extra(self):
data = get_extra_data()
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('extra' in result)
extra = result['extra']
self._check_vars_sanitized(extra, proc)
示例3: test_cookie_as_string_with_partials
def test_cookie_as_string_with_partials(self):
data = get_http_data()
data['request']['cookies'] = 'foo=bar;password;baz=bar'
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('request' in result)
http = result['request']
self.assertEquals(http['cookies'], 'foo=bar;password;baz=bar' % dict(m=proc.MASK))
示例4: test_http
def test_http(self):
data = get_http_data()
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('request' in result)
http = result['request']
for n in ('data', 'env', 'headers', 'cookies'):
self.assertTrue(n in http)
self._check_vars_sanitized(http[n], proc)
示例5: test_querystring_as_string
def test_querystring_as_string(self):
data = {
'sentry.interfaces.Http': {
'query_string': 'foo=bar&password=hello&the_secret=hello&a_password_here=hello',
}
}
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('sentry.interfaces.Http' in result)
http = result['sentry.interfaces.Http']
self.assertEquals(http['query_string'], 'foo=bar&password=%(m)s&the_secret=%(m)s&a_password_here=%(m)s' % dict(m=proc.MASK))
示例6: test_querystring_as_string_with_partials
def test_querystring_as_string_with_partials(self):
data = {
'sentry.interfaces.Http': {
'query_string': 'foo=bar&password&baz=bar',
}
}
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('sentry.interfaces.Http' in result)
http = result['sentry.interfaces.Http']
self.assertEquals(http['query_string'], 'foo=bar&password&baz=bar' % dict(m=proc.MASK))
示例7: test_querystring_as_string
def test_querystring_as_string(self):
data = get_http_data()
data['request']['query_string'] = 'foo=bar&password=hello&the_secret=hello'\
'&a_password_here=hello&api_key=secret_key'
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('request' in result)
http = result['request']
self.assertEquals(
http['query_string'],
'foo=bar&password=%(m)s&the_secret=%(m)s'
'&a_password_here=%(m)s&api_key=%(m)s' % dict(m=proc.MASK))
示例8: test_cookie_as_string
def test_cookie_as_string(self):
data = get_http_data()
data['request']['cookies'] = 'foo=bar;password=hello;the_secret=hello'\
';a_password_here=hello;api_key=secret_key'
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('request' in result)
http = result['request']
self.assertEquals(
http['cookies'],
'foo=bar;password=%(m)s;the_secret=%(m)s'
';a_password_here=%(m)s;api_key=%(m)s' % dict(m=proc.MASK))
示例9: test_cookie_as_string
def test_cookie_as_string(self):
data = get_http_data()
data["request"]["cookies"] = (
"foo=bar;password=hello;the_secret=hello" ";a_password_here=hello;api_key=secret_key"
)
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue("request" in result)
http = result["request"]
self.assertEquals(
http["cookies"],
"foo=bar;password=%(m)s;the_secret=%(m)s" ";a_password_here=%(m)s;api_key=%(m)s" % dict(m=proc.MASK),
)
示例10: test_http
def test_http(self):
data = {
'sentry.interfaces.Http': {
'data': {
'foo': 'bar',
'password': 'hello',
'the_secret': 'hello',
'a_password_here': 'hello',
},
'env': {
'foo': 'bar',
'password': 'hello',
'the_secret': 'hello',
'a_password_here': 'hello',
},
'headers': {
'foo': 'bar',
'password': 'hello',
'the_secret': 'hello',
'a_password_here': 'hello',
},
'cookies': {
'foo': 'bar',
'password': 'hello',
'the_secret': 'hello',
'a_password_here': 'hello',
},
}
}
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('sentry.interfaces.Http' in result)
http = result['sentry.interfaces.Http']
for n in ('data', 'env', 'headers', 'cookies'):
self.assertTrue(n in http)
vars = http[n]
self.assertTrue('foo' in vars)
self.assertEquals(vars['foo'], 'bar')
self.assertTrue('password' in vars)
self.assertEquals(vars['password'], proc.MASK)
self.assertTrue('the_secret' in vars)
self.assertEquals(vars['the_secret'], proc.MASK)
self.assertTrue('a_password_here' in vars)
self.assertEquals(vars['a_password_here'], proc.MASK)
示例11: test_stacktrace
def test_stacktrace(self):
data = {
'sentry.interfaces.Stacktrace': {
'frames': [{'vars': VARS}],
}
}
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('sentry.interfaces.Stacktrace' in result)
stack = result['sentry.interfaces.Stacktrace']
self.assertTrue('frames' in stack)
self.assertEquals(len(stack['frames']), 1)
frame = stack['frames'][0]
self.assertTrue('vars' in frame)
self._check_vars_sanitized(frame['vars'], proc)
示例12: test_http
def test_http(self):
data = {
'sentry.interfaces.Http': {
'data': VARS,
'env': VARS,
'headers': VARS,
'cookies': VARS,
}
}
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
self.assertTrue('sentry.interfaces.Http' in result)
http = result['sentry.interfaces.Http']
for n in ('data', 'env', 'headers', 'cookies'):
self.assertTrue(n in http)
self._check_vars_sanitized(http[n], proc)
示例13: test_stacktrace
def test_stacktrace(self, *args, **kwargs):
"""
Check whether sensitive variables are properly stripped from stack-trace
messages.
"""
data = get_stack_trace_data_real()
proc = SanitizePasswordsProcessor(Mock())
result = proc.process(data)
# data['exception']['values'][-1]['stacktrace']['frames'][0]['vars']
self.assertTrue('exception' in result)
exception = result['exception']
self.assertTrue('values' in exception)
values = exception['values']
stack = values[-1]['stacktrace']
self.assertTrue('frames' in stack)
self.assertEquals(len(stack['frames']), 2)
frame = stack['frames'][1] # frame of will_throw_type_error()
self.assertTrue('vars' in frame)
self._check_vars_sanitized(frame['vars'], proc)
示例14: test_sanitize_credit_card_amex
def test_sanitize_credit_card_amex(self):
# AMEX numbers are 15 digits, not 16
proc = SanitizePasswordsProcessor(Mock())
result = proc.sanitize('foo', '424242424242424')
self.assertEquals(result, proc.MASK)
示例15: test_sanitize_credit_card
def test_sanitize_credit_card(self):
proc = SanitizePasswordsProcessor(Mock())
result = proc.sanitize('foo', '4242424242424242')
self.assertEquals(result, proc.MASK)