Repository navigation
fix: refuse outbound edits that strand route.final, and stop the Node Rules crash - #16
Merged
Merged
Conversation
… Rules crash Two bugs with one trigger: a node filter that matches no nodes (#14). An empty filter is dropped from config.json, but route.final could still name it. sing-box check does not validate that reference, so the config was saved and the core then failed at start with "default outbound not found". UpdateOutboundsConfig now refuses any edit that would remove an outbound still named by route.final, a route rule, a rule-set download_detour or a DNS server detour, and leaves the working config in place. Only references the edit itself breaks are reported, so an already-dangling one cannot block the edit that fixes it. The Node Rules page threw "members is not iterable" because a filter with no members was sent as members: null. The preview now always sends arrays, filters send excludes: [] instead of null, and the frontend normalises the preview where it enters the app. Refs #14
7 tasks done
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 #14.
Summary
The issue reports two symptoms with one trigger: a node filter that ends up matching no nodes.
1. sing-box refuses to start (
default outbound not found: Other Nodes)An empty filter is dropped from
config.json(sing-box rejects a group with no members), butroute.finalcould still name it.sing-box checkparses the config without building the router, so it does not validate that reference: the config was saved, and the core only failed at start. On a host whose init system respawns, that is a crash loop.UpdateOutboundsConfignow refuses any edit that would remove an outbound still named by:route.finaldownload_detourdetourThe working config is left untouched and the error names the outbound and where it is used, for example
"Other Nodes" (used by route.final).Every outbound write goes through that one function, so this covers a node-rules apply, a subscription refresh and deleting an outbound by hand.
Only references the edit itself breaks are reported. A reference that was already dangling does not block later edits, so someone already in the broken state can still repair it from the panel.
2. Node Rules page crash (
members is not iterable)A filter with no members was sent as
members: null(a nil Go slice), and the page iterates that field on every render.membersandunmatched.excludes: []instead ofnull(the odd field noticed on the fallback filter).Behaviour change to be aware of
A subscription refresh that would empty a filter
route.finalpoints at now fails with this error until the route is repointed. The previous config keeps running. Emitting an empty group was not an option (sing-box rejects it), and silently repointingroute.finalwould change where traffic exits without the operator choosing it.Not addressed
The "Related" item at the end of the issue (the
download_detourselect not rendering in the Rule Sets dialog) was not investigated here.Test plan
Other Nodeswhileroute.finalnames it is refused and the config file is byte-identical afterwardsmembers: nullpayloadgo testforsingbox/config/...,routes,architecture;bun test;bun run buildroute.finalon the fallback group, then Apply