Skip to content

feat: default BIND_HOST to loopback so the dashboard is not LAN-exposed - #35

Closed
im0xMagnus wants to merge 1 commit into
MiaAI-Lab:mainfrom
im0xMagnus:feat/localhost-bind-default
Closed

feat: default BIND_HOST to loopback so the dashboard is not LAN-exposed#35
im0xMagnus wants to merge 1 commit into
MiaAI-Lab:mainfrom
im0xMagnus:feat/localhost-bind-default

Conversation

@im0xMagnus

Copy link
Copy Markdown

Why

The dashboard is unauthenticated (server/validate.js calls it "an otherwise unauthenticated LAN dashboard") and ships SSH exec, shutdown-all (passwordless-sudo power-off), and Wake-on-LAN. It defaulted to BIND_HOST=0.0.0.0, so a bare-metal npm start exposed all of that on every LAN interface — anyone on the network could power off every Spark, unauthenticated. This defaults the bind to loopback instead.

What changed

  • server/index.js: BIND_HOST defaults to 127.0.0.1 (was 0.0.0.0); startup now warns when bound to a non-loopback address.
  • README.md, .env.example, CHANGELOG.md updated.

Non-breaking for Docker

docker-compose.yml already sets BIND_HOST=0.0.0.0 explicitly (network_mode: host), so this only changes behaviour when the env var is unset — i.e. bare-metal npm start.

Migration

If you access sparkDash from another machine via bare-metal npm start, set BIND_HOST to the host's LAN IP (or 0.0.0.0). Documented in README + .env.example + the CHANGELOG entry.

Notes

  • Left the version bump to you — added an [Unreleased] CHANGELOG section.
  • docker:dev still reaches the dashboard via Vite :5173 (bound 0.0.0.0) proxying to the now-loopback API; this hardens the prod / npm start server bind, not the dev Vite port.
  • No test added: BIND_HOST resolution is an import-time side-effect with no bootstrap test harness (matches existing conventions).

The dashboard is unauthenticated and ships SSH exec plus shutdown-all and
Wake-on-LAN, but the server defaulted to 0.0.0.0 — exposing those controls on
every LAN interface for bare-metal `npm start` users. Default BIND_HOST to
127.0.0.1, warn at startup when bound to a non-loopback address, and document
opting in to the LAN. Docker is unaffected: docker-compose.yml sets
BIND_HOST=0.0.0.0 explicitly, so this only changes the unset-env default.
MiaAI-Lab pushed a commit that referenced this pull request Aug 16, 2026
Bare-metal npm start no longer exposes unauthenticated SSH/power on the LAN; Docker still binds 0.0.0.0. Decode bench now rejects ports that are not configured, matching showcase. Thanks #35, #45, #39.

Co-authored-by: Cursor <cursoragent@cursor.com>
@MiaAI-Lab

Copy link
Copy Markdown
Owner

Landed on main in 7c6db24 — thanks.

This was the right call: the dashboard is unauthenticated and can SSH / shutdown-all, so npm start should not bind 0.0.0.0 unless you opt in.

What went in:

  • BIND_HOST defaults to 127.0.0.1
  • startup log when loopback, warning when not
  • .env.example, README, CHANGELOG

Docker is unchanged: docker-compose.yml already sets BIND_HOST=0.0.0.0 with host networking. Migration: bare-metal access from another machine needs BIND_HOST set to a LAN IP or 0.0.0.0.

Closing rather than merging the branch — CHANGELOG / README / server/index.js all conflicted with 1.8.x.

@MiaAI-Lab MiaAI-Lab closed this Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants