Skip to content

fix(mdns): make LAN device discovery opt-in (off by default)#3937

Merged
louis030195 merged 2 commits into
mainfrom
claude/mdns-off-by-default
Jun 9, 2026
Merged

fix(mdns): make LAN device discovery opt-in (off by default)#3937
louis030195 merged 2 commits into
mainfrom
claude/mdns-off-by-default

Conversation

@louis030195

Copy link
Copy Markdown
Collaborator

What

mDNS LAN peer discovery (advertise + browse) opened a multicast socket on every startup, which makes macOS prompt for "Local Network" access for every user, even those who never use multi-device sync. This makes discovery opt-in, off by default.

mdns opt-in flow

Why

mdns::advertise() was called unconditionally in both the engine server and the app server-core, and Settings -> Pipes auto-browses on mount. Both create the ServiceDaemon (multicast socket), which is what triggers the prompt. There was no way to turn it off.

Change

  • Add a default-off ENABLED flag to the mdns module (set_enabled() / is_enabled()). While disabled, advertise() and browse() return early before creating the daemon, so there is no multicast and no permission prompt.
  • Engine + CLI: new --enable-mdns flag (env SCREENPIPE_ENABLE_MDNS), default false, applied via set_enabled() at startup.
  • Desktop app: server_core reads SCREENPIPE_ENABLE_MDNS and applies it before advertising.
  • SSH and Tailscale discovery are unaffected. Only the mDNS LAN leg is gated.

Files

  • crates/screenpipe-connect/src/mdns.rs (flag + gate on advertise/browse)
  • crates/screenpipe-engine/src/cli/mod.rs (--enable-mdns arg)
  • crates/screenpipe-engine/src/bin/screenpipe-engine.rs (apply at startup)
  • apps/screenpipe-app-tauri/src-tauri/src/server_core.rs (app env gate)

Opt back in

  • CLI / engine: screenpipe --enable-mdns or SCREENPIPE_ENABLE_MDNS=1
  • Desktop app: SCREENPIPE_ENABLE_MDNS=1

Verification

  • cargo check -p screenpipe-connect -p screenpipe-engine --bins --lib passes clean on latest main.
  • server_core.rs is a small env read + one call. It is not in the root cargo workspace, so it was not separately compiled here.

Follow-up (optional)

A user-facing Settings toggle can layer on top: add enableMdns to RecordingSettings (camelCase, serde default false) and regenerate tauri bindings. Left out here to keep the change all-Rust and avoid bindings churn.

🤖 Generated with Claude Code

Louis Beaumont and others added 2 commits June 9, 2026 11:00
mDNS advertise + browse opened a multicast socket at every startup, which makes
macOS prompt for "Local Network" access even for users who never use multi-device
sync. The advertise call was unconditional in both the engine server and the app
server-core, and Settings -> Pipes auto-browses on mount.

Gate mDNS behind a default-off flag in the mdns module: while disabled,
advertise() and browse() are no-ops that never create the daemon, open a
multicast socket, or trigger the permission prompt. Opt in via
`screenpipe --enable-mdns` / `SCREENPIPE_ENABLE_MDNS=1` (engine + CLI) or the
same env var in the desktop app. SSH/Tailscale discovery is unaffected; only the
mDNS LAN leg is gated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@louis030195 louis030195 merged commit 17b6f8d into main Jun 9, 2026
22 checks passed
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