refactor(auth): reuse oidc_env's truthy-bool helper for BAMBUDDY_LOCAL_LOGIN

_local_login_env_bypass() re-inlined the same {"true", "1", "yes"} set
oidc_env._env_bool already enforces, so the typo-guard existed in two
places. oidc_env has no module-scope import of models (its model
imports are lazy inside apply_env_oidc_provider), so importing
_env_bool at module scope here is not a cycle -- confirmed by
importing backend.app.main and this module directly.
This commit is contained in:
Marian
2026-07-31 13:12:44 +00:00
parent f6e0d76731
commit be19461470
+2 -1
View File
@@ -35,6 +35,7 @@ from backend.app.core.auth import (
security,
)
from backend.app.core.database import async_session, get_db
from backend.app.core.oidc_env import _env_bool
from backend.app.core.permissions import ALL_PERMISSIONS
from backend.app.models.auth_ephemeral import AuthEphemeralToken, AuthRateLimitEvent, EventType, TokenType
from backend.app.models.group import Group
@@ -122,7 +123,7 @@ def _local_login_env_bypass() -> bool:
an install whose SSO provider is unreachable. Accepted truthy values:
``true``, ``1``, ``yes`` (case-insensitive).
"""
return os.environ.get("BAMBUDDY_LOCAL_LOGIN", "").strip().lower() in {"true", "1", "yes"}
return _env_bool("BAMBUDDY_LOCAL_LOGIN", False)
def _get_client_ip(request: Request) -> str: