Repository navigation
fix(nodes): require opt-in before binding the LAN listener to all interfaces #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
itsskofficial
merged 6 commits into
existence-master:main
from
wanjinhao1:agent/fix-177-lan-bind-optin
Oct 21, 2026
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cbb329b
Add nodes.lan_bind_all opt-in before binding the LAN listener to 0.0.0.0
wanjinhao1 135e895
Merge branch 'main' into agent/fix-177-lan-bind-optin
itsskofficial 02f09d8
docs(nodes): document bind_all, add the changelog entry and plain wor…
itsskofficial 745cec8
fix(nodes): pairing switch drives lan_bind_all, loopback-only adverti…
wanjinhao1 12b09a8
Merge branch 'main' into agent/fix-177-lan-bind-optin
itsskofficial 041c59f
fix(nodes): doctor reports listener failures before bind scope; warn …
wanjinhao1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| **Sentient no longer opens itself to your whole network on its own.** Listening beyond this computer for devices | ||
| now needs its own opt-in (`nodes.lan_bind_all`), and Settings and `sentient doctor` warn while it is on. |
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| """SAFE-15: binding the LAN device listener to all interfaces must be an explicit opt-in.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import socket | ||
|
|
||
|
|
||
| def _free_port() -> int: | ||
| with socket.socket() as s: | ||
| s.bind(("127.0.0.1", 0)) | ||
| return s.getsockname()[1] | ||
|
|
||
|
|
||
| def _enable_lan(core, *, bind_all: bool) -> None: | ||
| core.config.nodes.lan_enabled = True | ||
| core.config.nodes.lan_bind_all = bind_all | ||
| core.config.nodes.lan_port = _free_port() | ||
| core.config.nodes.mdns_enabled = False | ||
|
|
||
|
|
||
| def test_lan_bind_all_defaults_off(config): | ||
| assert config.nodes.lan_bind_all is False | ||
|
|
||
|
|
||
| async def test_apply_config_binds_loopback_by_default(nodes_client): | ||
| client = nodes_client() | ||
| core = client.core | ||
| _enable_lan(core, bind_all=False) | ||
| await core.nodes.apply_config() | ||
| try: | ||
| assert core.nodes.lan and core.nodes.lan.running | ||
| assert core.nodes.lan_host == "127.0.0.1" | ||
| status = core.nodes.lan_status() | ||
| assert status["bind_all"] is False # not exposed beyond this computer | ||
| finally: | ||
| await core.nodes.lan.stop() | ||
|
|
||
|
|
||
| async def test_apply_config_requires_opt_in_to_bind_all_interfaces(nodes_client): | ||
| client = nodes_client() | ||
| core = client.core | ||
| _enable_lan(core, bind_all=True) | ||
| await core.nodes.apply_config() | ||
| try: | ||
| assert core.nodes.lan and core.nodes.lan.running | ||
| assert core.nodes.lan_host == "0.0.0.0" | ||
| status = core.nodes.lan_status() | ||
| assert status["bind_all"] is True # surfaces the exposure warning in doctor and Settings | ||
| finally: | ||
| await core.nodes.lan.stop() |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.