Created
July 30, 2018 22:52
-
-
Save ehfeng/3c367653073fd5e860291edd9bf69152 to your computer and use it in GitHub Desktop.
Scrubbing sensitive data with Sentry's Python SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from raven.contrib.flask import Sentry | |
app = Flask(__name__) | |
# To remove all client-side processors | |
# app.config['SENTRY_PROCESSORS'] = tuple() | |
# To specify which processors you'd like to use (because the raven flask plugin does not allow for a `processor` arg) | |
# app.config['SENTRY_PROCESSORS'] = ('raven.processors.SanitizePasswordsProcessor', ) | |
sentry = Sentry(app) | |
@app.route('/') | |
def index(): | |
# masked correctly | |
sentry.client.context.merge({'extra': { | |
'example': '4242424242424242'}}) | |
# shows up in sentry wrapped in single quotes | |
example_var = "4242424242424242" | |
unfiltered_var = 'a' | |
raise Exception('baz') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment