mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6362] [Feature]: Support age-encrypted proxy-providers in subscription output #4315
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4315
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jshir700 on GitHub (Aug 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6362
Is your feature request related to a problem?
Operators who serve Clash-compatible subscriptions (e.g.
/clash/) to end-users running Meta/Mihomo clients sometimes need the subscription to containproxy-providersentries that reference encrypted remote YAML files. Meta supports encrypting the entireproxy-providersblock with an age public key using theage-secret-keyfield — a standard that mirrors how individual share links can be protected.Currently, 3x-ui's subscription output contains only raw proxy entries (or a flat outbound list in JSON mode). There is no way to emit a
proxy-providers:block, nor any way to feed theage-secret-keythat Meta requires to decrypt the remote provider file. This forces operators to either:proxy-providers— adding operational overhead that could live inside 3x-ui natively.Describe the solution you'd like
Add optional
proxy-providersgeneration support to the Clash (/clash/) subscription output, with a configurableage-secret-keyfor encrypting the provider block.Proposed behavior:
New panel setting — a toggle and key input in the Subscription settings page:
subClashProxyProvidersEnable(boolean, defaultfalse) — when off, current behavior is preserved.subClashAgeSecretKey(string, stored encrypted via the existing secret-storage layer) — the age private key in standardAGE-SECRET-KEY-...form. Optional; when omitted the provider is emitted unencrypted.Provider configuration — a text area in the subscription settings where the operator pastes one or more
proxy-providersentries in standard Meta format:(Format follows the Meta proxy-providers spec.)
Output behavior — when enabled, the
/clash/endpoint appends theproxy-providers:block to the generated Clash YAML. IfsubClashAgeSecretKeyis set, the entireproxy-providers:content is encrypted with the corresponding age public key and theage-secret-keyfield is injected alongside it:Backward compatibility — when the feature is disabled (default),
/clash/output is byte-for-byte identical to today's output. No schema migration required for existing rows.Security — the age secret key is stored using the same encryption-at-rest approach as
tgBotToken(via the existing secret-setting layer), never logged or exposed in API responses.Alternatives you've considered
proxy-providerswith encryption. Adds an extra component that must be maintained, monitored, and kept in sync with 3x-ui updates.Concrete use case
An operator manages ~80 clients through a single 3x-ui panel. They want each client to receive a single
/clash/subscription URL that Meta can consume directly. The operator also wants to distribute a sharedproxy-providerslist (mirrored by a CDN) that all clients update automatically — but they do not want the provider file contents exposed in plaintext to anyone who intercepts the subscription. Withage-secret-keybuilt into 3x-ui, the operator stores the age private key once in the panel, and every/clash/response automatically carries the encrypted block, requiring zero external tooling.Mockups, screenshots, or examples
Reference implementation in Meta docs: https://wiki.metacubex.one/config/proxy-providers/?age-secret-key
Example expected YAML output (with key set):
Example expected YAML output (key not set — provider unencrypted):
Which parts of the panel would this affect?
Subscription (share links / Clash / JSON), Other
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Aug 29, 2026):
Most of what you are asking for already works on the current code — the panel can already emit a
proxy-providers:block and a top-levelage-secret-key:line into/clash/output today. The premise "there is no way to emit aproxy-providers:block, nor any way to feed theage-secret-key" is no longer accurate; what is genuinely missing is only the panel-side age encryption step, and that part has a problem worth settling before it is designed.What already works
GetClashmerges the operator's Clash routing setting into the generated config when the routing toggle is on (internal/sub/clash_service.go:101-112), and for an inline valuemergeClashRulesYAMLcopies every top-level key that is notrulesinto the config verbatim:That includes
proxy-providers,age-secret-key, or any other key mihomo accepts. It landed in98ba8803— "fix(subClashService): improve merging of clash rules in YAML (#5054)" — andgit tag --contains 98ba8803shows it first shipped in v3.3.0, so every release from v3.3.0 through v3.7.0 has it.To use it: Panel → Settings → Subscription → the "Clash / Mihomo" tab, turn on
subClashEnableRouting("Enable routing"), and paste your YAML intosubClashRules("Global routing rules",SubscriptionGeneralTab.tsx:363-377):Two caveats that follow directly from
base[key] = value:Any top-level key you supply replaces the generated one — it is not merged. The base config builds
proxy-groupswith this client's proxy names plusDIRECT(clash_service.go:91-99); pasting your ownproxy-groupsdiscards that, henceinclude-all: true(or an explicit list) above. Never paste aproxies:key — it would wipe the client's own nodes out of the profile.This works only when the setting holds inline YAML. If you instead put an
https://URL there, the remote path applies, and it allowlists exactly three keys —remoteClashAllowedKeyreturns true only for"proxy-groups", "rule-providers", "rules"(clash_service.go:911-918).proxy-providersis silently dropped, and a proxy-group referencing one is rejected outright:This is deliberate, not an oversight: it is pinned by
TestMergeRemoteClashRulesPreservesGeneratedProxies(internal/sub/remote_routing_test.go:438, assertion"remote proxy-providers were imported"at:482) and by the"remote proxy provider use"case inTestRemoteClashRouteGraphValidation(:665-669). A remote source could otherwise inject arbitrary proxies into every client's profile.What is genuinely not there — and two premises that do not hold
The remaining ask is the panel performing the age encryption itself. Two things in the proposal need correcting first:
UpdateSecretwritestgBotTokenstraight through (internal/web/service/setting.go:1367-1374→saveSetting,:330-344), which stores the literal value in thesettingstable. ThefactoryDefaultSecretKeys/ secret handling is response masking — the value is withheld from API responses — not encryption. So "stored using the same encryption-at-rest approach astgBotToken" would not give the property you are after.AGE-SECRET-KEY-…needed to decrypt it. Anyone who intercepts that subscription therefore has everything required to read the provider file, so it does not protect "the provider file contents ... to anyone who intercepts the subscription". It only protects the file from someone who has the CDN URL but not a subscription — a narrower goal than the one written, and worth stating explicitly so the feature is not built against an expectation it cannot meet.I also could not verify
age-secret-keyas a mihomo field:grep -rni "age-secret"overinternal/,frontend/src,docs/contentanddocs/libreturns nothing, and I have no network access here, so I could not open the wiki. The link in the report ends in?age-secret-key, which is a query string rather than a documented anchor. If you can quote the exact mihomo doc section and the minimum mihomo version that supports it, that is the one piece that would let this be scoped — since the panel already emits the block, encryption is the only thing left to design.Related
proxy-groups/providers side of this.base[key] = valueloop quoted above.Not a duplicate of either: #5044 is already shipped, and #5889 does not cover encryption.
Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.