feat(gateway): add config to disable Bonjour/mDNS (fix #28174)#28301
feat(gateway): add config to disable Bonjour/mDNS (fix #28174)#28301zichen0116 wants to merge 6 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds Key changes:
Confidence Score: 4/5
Last reviewed commit: 8322ad0 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d07091741
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| mdnsMode: | ||
| cfgAtStart.gateway?.mdns?.enabled === false ? "off" : cfgAtStart.discovery?.mdns?.mode, |
There was a problem hiding this comment.
Align audit inputs with new mDNS disable switch
This new override changes runtime behavior so gateway.mdns.enabled=false forces mDNS off even when discovery.mdns.mode is still "full", but the security audit logic still derives risk only from discovery.mdns.mode. In that configuration, openclaw security audit can incorrectly report discovery.mdns_full_mode findings even though Bonjour is disabled, which makes the new config path produce stale/false risk output; audit should evaluate the effective mDNS state (including this new switch) before emitting that check.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
if (mdnsMode === "full") ----> if (mdnsMode === "full" && gatewayMdnsEnabled)
|
This pull request has been automatically marked as stale due to inactivity. |
…rride When gateway.mdns.enabled=false the Bonjour stack is never started, so discovery.mdns.mode="full" no longer leaks host metadata. The security audit was deriving mDNS risk solely from discovery.mdns.mode and would emit a stale/false-positive mdns_full_mode finding in that configuration. Guard the check with the effective mDNS state: skip the finding whenever gateway.mdns.enabled is explicitly false, regardless of the mode value. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Addressed review feedback, please take another look. |
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
OPENCLAW_DISABLE_BONJOUR=1env var, and the crash risk makes the Gateway unusable on those platforms.gateway.mdns.enabled(boolean, defaulttrue) as a first-class config key with full schema validation, Zod schema, help text, UI labels, and docs. Setting it tofalseforcesmdnsMode: "off"in the discovery runtime, preventing both the advertiser and watchdog from starting.discovery.mdns.modeenum ("off"/"minimal"/"full") is untouched. No changes to the Bonjour advertiser itself, watchdog logic, or any channel/auth/tool code.OPENCLAW_DISABLE_BONJOUR=1retains its highest-priority override semantics.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
gateway.mdns.enabled(boolean). Omitting it keeps current behavior (mDNS on).gateway.mdns.enabled: falsedisables the Bonjour advertiser and its 60-second watchdog timer entirely — no more log spam on platforms without multicast.docs/gateway/bonjour.md"Disabling / configuration" section now documents the new config key with a JSON5 example and clarifies priority order:OPENCLAW_DISABLE_BONJOUR=1>gateway.mdns.enabled: false>discovery.mdns.mode: "off".Security Impact (required)
NoNoNoNoNoRepro + Verification
Environment
Steps
gateway: { mdns: { enabled: false } }to~/.openclaw/openclaw.json.openclaw gateway run.Expected
bonjour:log lines appear (advertiser never starts, watchdog never fires).Actual (before this fix)
gateway.mdns.*with an unknown-key error. Only the env var path works, and it is not surfaced in the UI or config docs.Evidence
4 new schema validation tests in
src/config/config.gateway-mdns.test.ts— all pass:schema.help.quality.test.ts(20 tests) and all other touched test files continue to pass.pnpm check(lint + format + typecheck) passes clean.Human Verification (required)
{ gateway: { mdns: { enabled: false } } }and rejects{ gateway: { mdns: { unknown: true } } }.pnpm checkpasses. All touched test files pass.gateway.mdnsomitted entirely (no regression);gateway.mdns.enabled: true(no-op, identical to default);discovery.mdns.mode: "off"still works independently of the new key.Compatibility / Migration
Yes—enableddefaults totrue; omitting the key is identical to current behavior.Yes— new optional keygateway.mdns.enabled.NoFailure Recovery (if this breaks)
gateway.mdnsfrom~/.openclaw/openclaw.json, or setOPENCLAW_DISABLE_BONJOUR=1to suppress mDNS via the pre-existing env path.src/config/types.gateway.ts,src/config/zod-schema.ts,src/gateway/server.impl.ts(one-line change each).gateway.mdns(Zod.strict()object not updated); Bonjour watchdog still firing whenenabled: false(override inserver.impl.tsnot reached).Risks and Mitigations
gateway.mdns.enabledvsdiscovery.mdns.mode) may confuse users.gateway.mdns.enabledis the simple boolean convenience path for the Android/Termux use case;discovery.mdns.modehandles finer-grained control. Priority order is documented inbonjour.md.gateway.mdns.enabled: falsesilently overridesdiscovery.mdns.modewhen both are set.enabled === false; all other combinations respectdiscovery.mdns.modeunchanged. Documented explicitly.