lib: add additional celery logger to sentry ignore

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-12-20 21:04:45 +01:00
parent 80d0b14bb8
commit c843f18743
3 changed files with 18 additions and 16 deletions

View File

@ -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))

View File

@ -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
}

View File

@ -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
}