fix(server): add --host to restrict which interfaces the server binds - #560
Open
RonenMars wants to merge 1 commit into
Open
fix(server): add --host to restrict which interfaces the server binds#560RonenMars wants to merge 1 commit into
RonenMars wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #517.
The problem
httpServer.listen(port)was called without a host, which is Node's listen-on-everything default, and there was no flag to narrow it. Every device on the LAN could reach port 8766, with the API key as the only thing stopping them. On a home network that is usually fine; on café Wi-Fi, a co-working space, or a corporate VLAN it is not.The README also claimed the server listens on
http://localhost:8766, which read as loopback-only and was simply wrong.The change
Adds
--host <address>toserve, threaded throughServerConfig.hostto the listen call. Default behaviour is unchanged — omitting it still binds all interfaces — so no existing deployment shifts under anyone.tb-streamer serve --host 127.0.0.1 # loopback onlyDocs corrected
Three README passages said or implied the wrong thing:
http://localhost:8766" → now states plainly that the default is all interfaces, port 8766.--host 127.0.0.1escape hatch instead of only describing the exposure.Verification
tsc --noEmitclean;biome checkclean across 378 files.__tests__/server-bind-retry.test.tsextended to cover the new binding path (+41/−8).One note for whoever reviews on this branch layout: it lives in a worktree under
.worktrees/, andnpm run lintthere silently checks nothing — biome ignores dot-directories, sobiome check .reports "These paths were provided but ignored: ." and exits clean. The checks above were run with explicit paths instead. Anyone verifying this branch in place should do the same rather than trusting a barenpm run lint.