From c5b91bdae8032642c13c5d39574f261c5858cdb8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 24 Feb 2020 19:14:43 +0100 Subject: [PATCH] providers/saml: fix CannotHandleAssertion Error still being sent to sentry --- passbook/audit/models.py | 1 + passbook/lib/sentry.py | 6 ++---- passbook/providers/saml/views.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/passbook/audit/models.py b/passbook/audit/models.py index 918bbf657..85bf5695e 100644 --- a/passbook/audit/models.py +++ b/passbook/audit/models.py @@ -137,6 +137,7 @@ class Event(UUIDModel): action=self.action, context=self.context, client_ip=self.client_ip, + user=self.user, ) return super().save(*args, **kwargs) diff --git a/passbook/lib/sentry.py b/passbook/lib/sentry.py index e20831355..d803ef729 100644 --- a/passbook/lib/sentry.py +++ b/passbook/lib/sentry.py @@ -32,13 +32,11 @@ def before_send(event, hint): ValidationError, OSError, RedisError, + SentryIgnoredException, ) if "exc_info" in hint: _exc_type, exc_value, _ = hint["exc_info"] - # pylint: disable=consider-merging-isinstance - if isinstance(exc_value, ignored_classes) or isinstance( - exc_value, SentryIgnoredException - ): + if isinstance(exc_value, ignored_classes): LOGGER.info("Supressing error %r", exc_value) return None return event diff --git a/passbook/providers/saml/views.py b/passbook/providers/saml/views.py index 844d9950d..ebd3041b5 100644 --- a/passbook/providers/saml/views.py +++ b/passbook/providers/saml/views.py @@ -105,7 +105,7 @@ class LoginBeginView(AccessRequiredView): params = self.provider.processor.generate_response() request.session[SESSION_KEY_PARAMS] = params except CannotHandleAssertion as exc: - LOGGER.error(exc) + LOGGER.info(exc) did_you_mean_link = request.build_absolute_uri( reverse( "passbook_providers_saml:saml-login-initiate",