Skip to content

fix(security): bind to localhost by default#17

Open
bkrabach wants to merge 1 commit intodanshapiro:mainfrom
bkrabach:fix/localhost-bind-default
Open

fix(security): bind to localhost by default#17
bkrabach wants to merge 1 commit intodanshapiro:mainfrom
bkrabach:fix/localhost-bind-default

Conversation

@bkrabach
Copy link

@bkrabach bkrabach commented Feb 4, 2026

Summary

Changes the default bind address from 0.0.0.0 to 127.0.0.1 for both the Express server and Vite dev server, mitigating the unauthenticated /local-file endpoint vulnerability on untrusted networks.

Problem

The /local-file endpoint serves arbitrary files without authentication. When the server binds to 0.0.0.0, anyone on the same network can read any file:

curl "http://<server-ip>:3001/local-file?path=/etc/passwd"

Solution

  • Default to 127.0.0.1 (localhost only)
  • Add HOST env var to opt-in to network exposure
  • Add VITE_HOST env var for the Vite dev server
  • Update startup message to show correct URL and hint

Usage

# Safe default (localhost only)
npm run dev

# Explicit network exposure (trusted networks)
HOST=0.0.0.0 npm run dev

Files Changed

  • server/index.ts - Server bind address + startup message
  • vite.config.ts - Vite dev server bind address

Changes the default bind address from 0.0.0.0 to 127.0.0.1 for both
the Express server and Vite dev server, mitigating exposure of the
unauthenticated /local-file endpoint on untrusted networks.

Changes:
- Server defaults to HOST=127.0.0.1 (was 0.0.0.0)
- Vite defaults to VITE_HOST=127.0.0.1 (was host: true)
- Updated startup message to show correct dev URL (port 5173)
- Added hint about HOST=0.0.0.0 for network exposure

Users can opt-in to network exposure with:
  HOST=0.0.0.0 npm run dev

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
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.

1 participant