Allow proxy-only dashboard auth

This commit is contained in:
MiTHRAL 2026-05-13 22:35:26 -04:00
parent 77464b8030
commit bd282b4dc3
2 changed files with 7 additions and 2 deletions

View file

@ -159,6 +159,8 @@ NPMs Access Lists use browser `Authorization` headers, so the app never needs
NPMs own docs call out that Access List basic auth and app-side auth both use `Authorization`, so the app-side login is the one to disable in production. NPMs own docs call out that Access List basic auth and app-side auth both use `Authorization`, so the app-side login is the one to disable in production.
If `DASHBOARD_USERNAME` and `DASHBOARD_PASSWORD_HASH` are omitted, the app now falls back to proxy-only mode automatically.
For direct local Docker testing without a proxy: For direct local Docker testing without a proxy:
```sh ```sh

View file

@ -603,8 +603,11 @@ def dashboard_auth_from_env() -> DashboardAuth | None:
if bool_env("DASHBOARD_AUTH_DISABLED", False): if bool_env("DASHBOARD_AUTH_DISABLED", False):
return None return None
username = env("DASHBOARD_USERNAME") username = os.getenv("DASHBOARD_USERNAME", "").strip()
encoded_hash = env("DASHBOARD_PASSWORD_HASH") encoded_hash = os.getenv("DASHBOARD_PASSWORD_HASH", "").strip()
if not username or not encoded_hash:
return None
ttl = int(os.getenv("DASHBOARD_SESSION_TTL_SECONDS", "28800")) ttl = int(os.getenv("DASHBOARD_SESSION_TTL_SECONDS", "28800"))
secure = bool_env("DASHBOARD_COOKIE_SECURE", False) secure = bool_env("DASHBOARD_COOKIE_SECURE", False)
return DashboardAuth( return DashboardAuth(