Repository navigation
fix(subscription): build Hysteria2 hosts whose FinalMask has no udp mask - #993
Merged
Merged
Conversation
- SubscriptionInboundData.finalmask is always a plain dict; host masks are dumped with Xray field names. The FinalMask | dict union turned dicts with no udp or tcp list (udpHop port hopping or brutal settings only) back into a FinalMask, and the share link, Clash Meta and sing-box builders then failed with "'FinalMask' object has no attribute 'get'", taking the whole subscription down - Read quicParams, udpHop and the salamander settings null-safely, since a core config may write them as null Follows up #987, whose exact case #974 already fixed.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
2 tasks done
Free-Guy-IR
added a commit
to Free-Guy-IR/panel
that referenced
this pull request
Nov 2, 2026
…ain bba95f274 Checked with git ls-remote on 2026-10-11 02:55 UTC. Panel dev moved from d94e157 to 83fe90e with 22 commits; main is still v5.4.1. - PasarGuard#879 (2d0ca81, loopback Xray client inbounds) is ported by design: the fork took the open pull request on 2026-09-25 as 2e7fc45 with migration bfd88026565b, the same listener rewrite. - PasarGuard#934 (a5b28f3) moves from the port queue to a dated waiver until 2026-11-09: the fork refuses to delete a core that nodes still use (W3-013, fix/node-health) instead of restarting those nodes. - PasarGuard#993 (Hysteria2 FinalMask without a udp mask) is queued until 2026-10-18: the fork has the same FinalMask | dict field and the same non-null-safe udpHop reads, so a udpHop-only host can fail the whole subscription. - PasarGuard#984, PasarGuard#985, PasarGuard#986, PasarGuard#989, PasarGuard#944, PasarGuard#864, PasarGuard#948, PasarGuard#951, PasarGuard#778, PasarGuard#774, PasarGuard#787, PasarGuard#994, PasarGuard#865, PasarGuard#875, PasarGuard#718, PasarGuard#967, PasarGuard#772, PasarGuard#662, PasarGuard#995 and PasarGuard#913 are queued as security: no until 2026-10-25, each with its reason; PasarGuard#913's node-removal half is already in the fork through sync_remove_users. - The branch commits that upstream squash-merged (the three dashboard branches, telegram/tests, fix/core-editor-api-section-followup, fix/hwid-count-test-cleanup, fix/hysteria-finalmask-quic-only) follow their squash, by patch-id or by an equal tree. Scripts main moved to bba95f274 (PasarGuard#35, PasarGuard#36, PasarGuard#37 after PasarGuard#34). The three squashes are queued security: no until 2026-10-25, and their pre-squash branch commits are waived as superseded (equal trees). Against live upstream the panel gate now fails only on the 17 port-queue commits classified security: yes, and the forks gate only on node f72ac0ef (security: yes). No upstream commit is undecided.
Free-Guy-IR
pushed a commit
to Free-Guy-IR/panel
that referenced
this pull request
Nov 3, 2026
…ask (PasarGuard#993) - SubscriptionInboundData.finalmask is always a plain dict; host masks are dumped with Xray field names. The FinalMask | dict union turned dicts with no udp or tcp list (udpHop port hopping or brutal settings only) back into a FinalMask, and the share link, Clash Meta and sing-box builders then failed with "'FinalMask' object has no attribute 'get'", taking the whole subscription down - Read quicParams, udpHop and the salamander settings null-safely, since a core config may write them as null Follows up PasarGuard#987, whose exact case PasarGuard#974 already fixed. (cherry picked from commit 2aaa5c1) Fork resolution: - app/subscription/base.py keeps the fork's conversion of a FinalMask or dict into finalmask_dict and reads quicParams and the salamander settings from it null-safely, as upstream now does. - tests/test_subscription_hysteria_finalmask.py keeps the fork's tests and adds upstream's PasarGuard#993 tests with the helpers they use. The udphop model tests that came with 7f670cf stay with that wave-2 pick. sing-box server_ports is asserted as 20000:20010: the fork already writes sing-box port ranges as START:END (7e7dca7), which is the form sing-box accepts. - The plain-dict finalmask also reaches the fork's OpenVPN, L2TP and MTProto readers in app/fork/subscription/helpers.py, which already take a dict.
Free-Guy-IR
pushed a commit
to Free-Guy-IR/panel
that referenced
this pull request
Nov 4, 2026
…ask (PasarGuard#993) - SubscriptionInboundData.finalmask is always a plain dict; host masks are dumped with Xray field names. The FinalMask | dict union turned dicts with no udp or tcp list (udpHop port hopping or brutal settings only) back into a FinalMask, and the share link, Clash Meta and sing-box builders then failed with "'FinalMask' object has no attribute 'get'", taking the whole subscription down - Read quicParams, udpHop and the salamander settings null-safely, since a core config may write them as null Follows up PasarGuard#987, whose exact case PasarGuard#974 already fixed. (cherry picked from commit 2aaa5c1) Fork resolution: - app/subscription/base.py keeps the fork's conversion of a FinalMask or dict into finalmask_dict and reads quicParams and the salamander settings from it null-safely, as upstream now does. - tests/test_subscription_hysteria_finalmask.py keeps the fork's tests and adds upstream's PasarGuard#993 tests with the helpers they use. The udphop model tests that came with 7f670cf stay with that wave-2 pick. sing-box server_ports is asserted as 20000:20010: the fork already writes sing-box port ranges as START:END (7e7dca7), which is the form sing-box accepts. - The plain-dict finalmask also reaches the fork's OpenVPN, L2TP and MTProto readers in app/fork/subscription/helpers.py, which already take a dict.
Free-Guy-IR
added a commit
to Free-Guy-IR/panel
that referenced
this pull request
Nov 4, 2026
…ream PasarGuard#974 Upstream 7f670cf tests, adapted to the fork test files, committed before the pick so they fail on 1fc2b45: - tests/test_subscription_xray_finalmask.py: udphop and exp survive the Xray stream settings; exp rejects a blank or non-string packet; exp is refused in header-custom items - tests/test_subscription_hysteria_finalmask.py: host and inbound FinalMask reach the Hysteria2 link, Clash Meta and sing-box builders, including after the NATS cache round trip; udphop validation; udphop passes through the fm link parameter. Inserted next to the PasarGuard#993 scaffolding the fork already had - tests/api/test_host.py: udphop and exp over the host API On 1fc2b45: 21 failed, 45 passed (non-API) and 3 failed, 8 passed (tests/api/test_host.py). Failures: "udphop" is not a FinalMaskUdpType, and "exp" does not match ^$|^(:?array|str|base64|hex)$.
Free-Guy-IR
pushed a commit
to Free-Guy-IR/panel
that referenced
this pull request
Nov 4, 2026
…ard#974) * fix(hosts): dump host FinalMask with Xray field names once - Hysteria2 links, Clash Meta and sing-box no longer fail for hosts with FinalMask settings - Host QUIC params survive a reload of the NATS host cache * feat(finalmask): add Xray udphop UDP mask - Hosts and core outbounds can set the udphop mask that Xray 26.9.9+ clients use for port hopping - Layer orders and values Xray cannot dial are rejected with a clear error * feat(finalmask): add Xray exp noise type - Offer exp in the UDP noise mask of the host and core-config editors - Reject exp outside UDP noise and require a non-empty template packet - Show a saved udphop mode outside the presets instead of an empty select * fix(finalmask): reject udphop intervals above the Xray int32 limit - Stop saving udphop intervals that Xray would wrap into another value or refuse with a misleading error (cherry picked from commit 7f670cf) Fork port notes: - app/, dashboard/ and locale hunks applied without conflict. - The three test files conflicted only because the RED commit before this pick already added upstream's tests to them (the hysteria test file is add/add: the fork created it when porting PasarGuard#993 first). The RED commit's version is kept; it differs from upstream only by the dropped helper docstrings and comments. - No fork-relocated copy needs the change: app/fork and dashboard/src/fork hold no copy of FinalMask or of the two finalmask editors (fork readers only take the openvpn, l2tp and mtproto keys).
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.
Summary
quicParams, such asudpHopport hopping or brutal settings, but noudpmask made the share link, Clash Meta and sing-box builders fail withAttributeError: 'FinalMask' object has no attribute 'get'. The subscription has no per-host error handling, so the whole subscription failed for every user who gets that host.SubscriptionInboundData.finalmaskwas typedFinalMask | dict | None, and Pydantic's smart union turned these dicts back into aFinalMaskwhile the builders expect a dict. The field is now always a plain dict, and aFinalMaskis dumped once with Xray field names.quicParams,udpHopand the salamander settings null-safely, since a core config can write them asnull(sing-box already did this).Follows up #987. The exact case reported there (salamander plus
quicParamswithoutudpHop) is already fixed on dev by #974, and is kept as a test.Upgrade note
With a NATS host cache, a host of this shape that was cached by the old code keeps its old cache entry, and its Hysteria links lack port hopping until the host is saved again or the core config is updated. Before this change, those hosts failed outright.
Tests
tests/test_subscription_hysteria_finalmask.py: host, inbound and NATS round trip withudpHoponly, brutal only, emptyquicParams, and explicit nulls in a core config. 8 fail on dev without the fix.test_record_node_usages_updates_totals, which also fails intermittently on dev.