Skip to content

No HA Supervisor /auth flow for password-gated public-site path #85

Closed

Description

@bdraco

Summary

When the dashboard runs as an HA add-on with `using_password=True` (i.e. exposed on a public port outside ingress), the legacy dashboard authenticates the user against Home Assistant Supervisor by POSTing to `http://supervisor/auth\` with the supervisor token. The new backend has no equivalent — its auth is either trusted-only via the ingress site or a single dashboard-managed password.

Most users won't hit this: ingress is the canonical add-on path and trusted-only is fine there. But a user who exposes the add-on on a custom port and wants to gate it behind HA credentials (rather than configure a separate dashboard password) is forced to manage two credential stores.

Legacy behavior

`esphome/dashboard/web_server.py:1364-1392` — `LoginHandler.post_ha_addon_login` POSTs `{username, password}` to `http://supervisor/auth\` with the `X-Supervisor-Token` header. On 200, the user gets a session cookie. On non-200, the request falls through to the dashboard-password check.

New backend

`esphome_device_builder/helpers/auth.py` — `AuthController` only checks against the dashboard's own password / session store. No supervisor pathway.

Suggested fix

When `settings.ha_addon` is true AND `SUPERVISOR_TOKEN` env var is set, add a fallback in `AuthController.authenticate` that POSTs to `http://supervisor/auth\` before falling through to the local password check. On 200, mint a session as usual. On non-200 / network error, fall through.

Plumb through aiohttp's existing `ClientSession` (so we don't spin up a new one per login attempt) and rate-limit failed attempts the same way the local password check does.

Edge cases

  • Supervisor is unreachable (sub-second timeout, fall through to local).
  • Multiple HA users with different passwords — supervisor's response doesn't carry a username back; we'd want to log which user authenticated for audit purposes.

Priority

Low. Most HA add-on users go through ingress; the public-port + password combination is a rare deployment.

Activity

  1. added
    enhancement
    on May 2, 2026
  2. bdraco commented on May 2, 2026

    @bdraco
    MemberAuthor

    Cautionary note before anyone picks this up: we may not want to port this at all. Worth careful consideration before implementing.

    Concerns:

    • Implicit attack surface. Posting credentials to http://supervisor/auth from inside the add-on container ties dashboard auth to a network-internal HTTP endpoint that the dashboard otherwise has no business talking to. If the supervisor token leaks (config dump, logs, error message), an attacker has a username/password oracle they can hammer. The legacy implementation has had years to audit; we'd be re-introducing the same surface fresh.
    • Two-credential UX. The whole point of the HA add-on path is that ingress already authenticates the user as their HA account. A separate password-gated public port that also uses HA credentials is a confusing middle-ground — most users either want ingress-only (no password prompt) or a dedicated dashboard password (decoupled from HA). Supporting "HA password but on the public port" sits in an uncanny valley.
    • Maintenance cost. Supervisor's auth API has changed shape over the years (token header rotation, response codes, rate limiting). Tracking those changes for a corner-case path is real ongoing work.
    • Alternative is already supported. Users who want HA-credential auth can run the add-on through ingress; users who want a public port can set using_password=True with a dedicated dashboard password. The combination this issue addresses (public port + HA credentials) has neither a strong use case nor a clean security story.

    Suggested resolution: defer / decline unless someone surfaces a concrete user need. If we close this, document it in docs/ARCHITECTURE.md under "Reverse-proxy / public-port deployment" so the choice is explicit rather than just absent.

  3. marcelveldt commented on May 2, 2026

    @marcelveldt
    Contributor

    I think we should drop this now that we've split up the ingress flow from the normal site.

  4. bdraco commented on May 2, 2026

    @bdraco
    MemberAuthor

    Closing as won't-fix.

    The legacy supervisor /auth path is only live when both --ha-addon is set AND DISABLE_HA_AUTHENTICATION is unset. Modern ingress-based deployments (the canonical add-on path) launch with DISABLE_HA_AUTHENTICATION=true because supervisor pre-authenticates ingress traffic upstream — the legacy code never reaches post_ha_addon_login on ingress. The supervisor /auth flow only matters when a user explicitly disables ingress, exposes a public port, and chooses "use HA credentials" instead of setting a dashboard password.

    The new backend already covers both canonical deployments:

    • Ingress → trusted-site mode (auth bypass for pre-authenticated ingress traffic — same role as the legacy DISABLE_HA_AUTHENTICATION=true path)
    • Public port → dashboard password via the existing AuthController (same role as the legacy local-password fallback)

    The supervisor /auth middle ground is a legacy artifact for a rare combination that has better alternatives today (set a dashboard password, or run a reverse proxy with whatever auth you prefer). Re-open if a real user hits this and the workarounds don't fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions