fix(server): bind localhost by default#337
Conversation
janhilgard
left a comment
There was a problem hiding this comment.
Review: fix(server): bind localhost by default
Addresses: Issue #68, finding #13
Summary: Changes the default --host from 0.0.0.0 to 127.0.0.1 in both the cli.py serve parser and the standalone server.py parser. Docs and help text updated accordingly.
Strengths
- Correct security default. Binding to all interfaces with no auth is an easy footgun, and localhost-by-default follows the principle of least privilege.
- Good refactor extracting
create_parser()frommain()inserver.pyso the test can inspect parser defaults directly. - Test coverage is clean and covers both entrypoints.
- Docs consistently updated across all three reference pages.
Issues / Suggestions
-
Breaking change for existing users. Anyone currently relying on the implicit
0.0.0.0binding (e.g. Docker containers, LAN-accessible setups, systemd services) will silently stop accepting remote connections after upgrading. This deserves a mention in the PR description and ideally a note in the changelog or migration guide. Consider whether a deprecation warning (log a warning when--hostis not explicitly set) would smooth the transition, though I acknowledge a clean default change is also defensible. -
Minor:
create_parser()docstring. The new function says"Create the standalone server argument parser."but it is also now importable and used from tests. A slightly broader docstring like"Create the argument parser for the standalone server entrypoint."would be more accurate since the word "standalone" might confuse readers into thinking it cannot be reused.
Overall this is a clean, well-scoped change. The only real concern is the silent behavioral change for existing deployments.
Verdict: LGTM with the caveat that the breaking change should be documented.
3eb29ef to
52a162e
Compare
Summary
127.0.0.1by default instead of0.0.0.0--host 0.0.0.0and update the docs/help text accordinglyTest plan
PYTHONPATH=/private/tmp/vllm-mlx-issue68-bind-local /opt/ai-runtime/venv-live/bin/python -m pytest tests/test_server.py -q/opt/ai-runtime/venv-live/bin/python -m black --check --fast vllm_mlx/server.py vllm_mlx/cli.py tests/test_server.py/opt/ai-runtime/venv-live/bin/python -m compileall vllm_mlx/server.py vllm_mlx/cli.py tests/test_server.py