From c843f187436579fa28f4528cd6fed1d8c19fcd9c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 20 Dec 2021 21:04:45 +0100 Subject: [PATCH] lib: add additional celery logger to sentry ignore Signed-off-by: Jens Langhammer --- authentik/lib/sentry.py | 1 + .../outpost/proxyv2/application/application.go | 16 ---------------- .../outpost/proxyv2/application/mode_common.go | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/authentik/lib/sentry.py b/authentik/lib/sentry.py index 3d69a7b2d..a0bd4eeec 100644 --- a/authentik/lib/sentry.py +++ b/authentik/lib/sentry.py @@ -110,6 +110,7 @@ def before_send(event: dict, hint: dict) -> Optional[dict]: "django.security.DisallowedHost", "django_redis.cache", "celery.backends.redis", + "celery.worker", ]: return None LOGGER.debug("sending event to sentry", exc=exc_value, source_logger=event.get("logger", None)) diff --git a/internal/outpost/proxyv2/application/application.go b/internal/outpost/proxyv2/application/application.go index 1c7604769..7ff9f207d 100644 --- a/internal/outpost/proxyv2/application/application.go +++ b/internal/outpost/proxyv2/application/application.go @@ -178,22 +178,6 @@ func NewApplication(p api.ProxyOutpostConfig, c *http.Client, cs *ak.CryptoStore return a, nil } -func (a *Application) IsAllowlisted(r *http.Request) bool { - for _, u := range a.UnauthenticatedRegex { - var testString string - if a.Mode() == api.PROXYMODE_PROXY || a.Mode() == api.PROXYMODE_FORWARD_SINGLE { - testString = r.URL.Path - } else { - testString = r.URL.String() - } - a.log.WithField("regex", u.String()).WithField("url", testString).Trace("Matching URL against allow list") - if u.MatchString(testString) { - return true - } - } - return false -} - func (a *Application) Mode() api.ProxyMode { return *a.proxyConfig.Mode } diff --git a/internal/outpost/proxyv2/application/mode_common.go b/internal/outpost/proxyv2/application/mode_common.go index a1430ad1e..fbd0c6943 100644 --- a/internal/outpost/proxyv2/application/mode_common.go +++ b/internal/outpost/proxyv2/application/mode_common.go @@ -6,6 +6,7 @@ import ( "net/http" "strings" + "goauthentik.io/api" "goauthentik.io/internal/constants" ) @@ -62,3 +63,19 @@ func (a *Application) addHeaders(headers http.Header, c *Claims) { } } } + +func (a *Application) IsAllowlisted(r *http.Request) bool { + for _, u := range a.UnauthenticatedRegex { + var testString string + if a.Mode() == api.PROXYMODE_PROXY || a.Mode() == api.PROXYMODE_FORWARD_SINGLE { + testString = r.URL.Path + } else { + testString = r.URL.String() + } + a.log.WithField("regex", u.String()).WithField("url", testString).Trace("Matching URL against allow list") + if u.MatchString(testString) { + return true + } + } + return false +}