getsentry / raven-python

Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
https://sentry.io
BSD 3-Clause "New" or "Revised" License
1.68k stars 657 forks source link

Flask Extension passing User object instead of attributes #1282

Closed Cabalist closed 6 years ago

Cabalist commented 6 years ago

We've started to notice these errors at the top of our issues:

screen shot 2018-08-02 at 5 46 16 pm

It appears that the AnonymousUser object is being passed directly to the 'user' parameter. Is this intentional? Should it not be the attributes listed in SENTRY_USER_ATTRS?

Edit:

I am using Flask-Security-3.0.0 and Flask-Login-0.4.0.

This is also happening with registered users.

Cabalist commented 6 years ago

We discovered the issue was on our side. We had added a logging.Filter and it was clobbering raven values. Specifically:

class ContextualFilter(logging.Filter):
    def filter(self, record):
        if has_request_context():
            record.user = current_user

Perhaps there needs to be a raven prefix/suffix to avoid this in the future?