feat(config): web_auth_required ON implicit (login obligatoriu pe rutele web)
Inverseaza default-ul C12: rutele web cer sesiune + CSRF implicit (sigur pentru prod). Dev rapid pe contul 1 = opt-out explicit AUTOPASS_WEB_AUTH_REQUIRED=false. Testele de comportament import/dashboard marcate explicit dev-mode; test nou blocheaza default-ul. 394 teste pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -147,3 +147,15 @@ def test_ruta_protejata_cu_sesiune_trece(client_auth):
|
||||
resp = client_auth.get("/protected")
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["account_id"] == 5
|
||||
|
||||
|
||||
def test_web_auth_required_default_true(monkeypatch):
|
||||
"""Default-ul de productie: auth web e ON daca AUTOPASS_WEB_AUTH_REQUIRED nu e setat.
|
||||
|
||||
Dev rapid pe cont 1 = opt-out explicit (AUTOPASS_WEB_AUTH_REQUIRED=false).
|
||||
"""
|
||||
monkeypatch.delenv("AUTOPASS_WEB_AUTH_REQUIRED", raising=False)
|
||||
from app.config import Settings, get_settings
|
||||
get_settings.cache_clear()
|
||||
assert Settings().web_auth_required is True
|
||||
get_settings.cache_clear()
|
||||
|
||||
Reference in New Issue
Block a user