Skip to content

Commit

Permalink
chore(superuser): Add loggers to _needs_validation
Browse files Browse the repository at this point in the history
  • Loading branch information
schew2381 committed Mar 5, 2024
1 parent 622827e commit 5cc92d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 0 additions & 5 deletions src/sentry/api/endpoints/auth_index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging

from django.conf import settings
from django.contrib.auth import logout
from django.contrib.auth.models import AnonymousUser
from django.utils.http import url_has_allowed_host_and_scheme
Expand Down Expand Up @@ -33,10 +32,6 @@

PREFILLED_SU_MODAL_KEY = "prefilled_su_modal"

DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL = getattr(
settings, "DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL", False
)


@control_silo_endpoint
class BaseAuthIndexEndpoint(Endpoint):
Expand Down
10 changes: 9 additions & 1 deletion src/sentry/auth/superuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@ def __init__(self, request, allowed_ips=UNSET, org_id=UNSET, current_datetime=No

@staticmethod
def _needs_validation():
if is_self_hosted() or DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL:
self_hosted = is_self_hosted()
logger.info(
"superuser.needs-validation",
extra={
"DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL": DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL,
"self_hosted": self_hosted,
},
)
if self_hosted or DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL:
return False
return settings.VALIDATE_SUPERUSER_ACCESS_CATEGORY_AND_REASON

Expand Down

0 comments on commit 5cc92d1

Please sign in to comment.