Sicherheit: Live-Aktionen nur mit aktivem Login; Seitenleiste warnt rot bei ausgeschaltetem Login
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,8 @@ PORT = "8276"
|
||||
|
||||
|
||||
def live_enabled() -> bool:
|
||||
return os.getenv("DEPLOY_LIVE", "false").lower() == "true"
|
||||
"""DEPLOY_LIVE=true UND aktiver Login (guard.auth_ok) – ohne Login bleibt alles im Dry-Run."""
|
||||
return os.getenv("DEPLOY_LIVE", "false").lower() == "true" and guard.auth_ok()
|
||||
|
||||
|
||||
def token_present() -> bool:
|
||||
|
||||
@@ -33,3 +33,10 @@ def describe() -> str:
|
||||
def denial(tenant_id: str) -> str:
|
||||
return (f"Tenant „{tenant_id}“ ist für Live-Schreibzugriffe nicht freigegeben (Env DEPLOY_ALLOWED_TENANTS = {describe()}). "
|
||||
"Dry-Runs sind weiterhin möglich.")
|
||||
|
||||
|
||||
def auth_ok() -> bool:
|
||||
"""Live-Schreibzugriffe nur mit aktivem Login der Admin-Plattform (sonst wäre sie – mit Mittwald-Token im Container – für jeden offen).
|
||||
Nur für lokale Experimente übersteuerbar: ALLOW_NO_AUTH_LIVE=true."""
|
||||
from app.settings import AUTH_ENABLED
|
||||
return AUTH_ENABLED or os.getenv("ALLOW_NO_AUTH_LIVE", "false").lower() == "true"
|
||||
|
||||
@@ -43,7 +43,7 @@ def key_present() -> bool:
|
||||
|
||||
|
||||
def writes_allowed() -> bool:
|
||||
return os.getenv("OIDC_SYNC_LIVE", "false").lower() == "true" or os.getenv("DEPLOY_LIVE", "false").lower() == "true"
|
||||
return (os.getenv("OIDC_SYNC_LIVE", "false").lower() == "true" or os.getenv("DEPLOY_LIVE", "false").lower() == "true") and guard.auth_ok()
|
||||
|
||||
|
||||
def base_url(db) -> str:
|
||||
|
||||
Reference in New Issue
Block a user