[GH-ISSUE #6363] [Feature]: Support proxy-providers in remote Clash routing source; add inline age-secret-key path for encrypted provider files #4318

Open
opened 2026-10-31 20:38:48 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @jshir700 on GitHub (Aug 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6363

When 3x-ui's Clash subscription is used with Meta/Mihomo clients that rely on remote proxy-provider files (e.g. a CDN-hosted providers/default.yaml that is updated independently), operators currently have no native path to express that dependency through the panel. The two ways to inject a proxy-providers: block today both fall short for this workflow:

Inline mode (currently the only working path) — paste the full provider YAML directly into the panel's "Global routing rules" field. This works for small, static provider lists but breaks the common case where the provider file is hosted on a CDN and updated independently. More critically, because mergeClashRulesYAML copies every top-level key except rules verbatim (clash_service.go:808-817), any top-level key the operator pastes replaces the panel-generated one. Pasting a full proxy-groups: block wipes the panel's auto-generated groups (including PROXY and DIRECT). Operators must therefore also restate every proxy-group — including include-all: true or an explicit proxies: list — inside the pasted block, which defeats the purpose of a centrally-managed subscription.

Remote mode (the intended path for large/CDN-backed setups) — point the "Global routing rules" field at a remote URL. Here proxy-providers is silently dropped: remoteClashAllowedKey() only returns true for proxy-groups, rule-providers, and rules (clash_service.go:911-918), and validateRemoteClashValue enforces this with the comment remote Clash proxy-group %q cannot use proxy-providers (clash_service.go:890). This guard was introduced in #5044 / #5054 to prevent a compromised remote source from injecting arbitrary proxies into every client's profile. It is correct for untrusted sources but too strict for the operator's own CDN — the operator controls both ends and the guard adds no real protection in that scenario.

The net result: operators who want a single 3x-ui subscription URL that also carries a reference to a remote, optionally age-encrypted provider file either (a) maintain a separate static Clash YAML outside the panel (two sources of truth), or (b) embed the full inline config and restate every proxy-group on every update.

Describe the solution you'd like

Part A — Relax the remote-source guard for proxy-providers

When the Clash routing source is a remote URL, extend the allowed-key set so that proxy-providers is accepted alongside proxy-groups, rule-providers, and rules. Mirror the existing validation pattern for rule-providers (verify each entry is a named map with required fields). Reject groups that reference use from a remote source (the current safety check stays) — only relax the key-allowlist itself.

This keeps the security boundary: a remote source still cannot inject arbitrary proxies into the generated profile. It can only declare where the provider files live; the actual proxy contents come from the operator's CDN, not from the routing YAML.

Code change sketch:

func remoteClashAllowedKey(key string) bool {
    switch key {
    case "proxy-groups", "rule-providers", "proxy-providers", "rules":
        return true
    default:
        return false
    }
}

func validateRemoteClashValue(key string, value any) error {
    switch key {
    // ... existing cases ...
    case "proxy-providers":
        providers, ok := value.(map[string]any)
        if !ok {
            return fmt.Errorf("remote Clash proxy-providers must be a map")
        }
        for name, provider := range providers {
            if strings.TrimSpace(name) == "" {
                return fmt.Errorf("remote Clash proxy-provider name must not be empty")
            }
            if _, ok := provider.(map[string]any); !ok {
                return fmt.Errorf("remote Clash proxy-provider %q must be a map", name)
            }
        }
    }
    return nil
}

Then in mergeRemoteClashRules, handle the new case like rule-providers:

case "proxy-providers":
    providers, _ := value.(map[string]any)
    base["proxy-providers"] = providers

Part B — Document the inline path as the supported route for age-secret-key

The age-secret-key field is a per-provider field inside the proxy-providers map in the Meta spec (docs, minimum Meta v1.16.x). It works only when the provider YAML is emitted inline in the subscription — the remote source path cannot carry it because proxy-providers is rejected at the remote-allowlist stage (Part A above fixes this, but the inline path is simpler for operators who host small provider files themselves).

Document that operators should paste a complete config block (including proxy-groups with include-all: true or an explicit proxies: list) into the inline "Global routing rules" field when using age-secret-key. Provide a ready-to-copy template in the UI or docs:

proxy-providers:
  default:
    type: http
    url: "https://cdn.example.com/providers/default.yaml"
    path: ./proxy_providers/default.yaml
    interval: 3600
    proxy: DIRECT
    size-limit: 1000000
    age-secret-key: AGE-SECRET-KEY-1ZTQLLN0A4U3ZTT3DCZKYN0CGZEZQLWX2DFTXUWMT4ZHR0N2UG6LSW9NT0N
proxy-groups:
  - name: PROXY
    type: select
    include-all: true
rules:
  - MATCH,PROXY

Note: the panel should warn (or pre-fill) the proxy-groups block when proxy-providers is detected in the inline input, to prevent operators from accidentally wiping generated groups.

What is intentionally NOT in scope

  • Panel-side age encryption — having 3x-ui encrypt the provider file before serving it is not part of this request. The provider file lives on the operator's CDN; the operator encrypts it server-side (e.g. via mihomo age encrypt <public_key> <source> <target>) and hosts the encrypted result. 3x-ui only needs to emit the age-secret-key field so clients can decrypt it.
  • Encryption-at-rest for the setting — the value lives in the operator's inline YAML, not in a panel setting. This sidesteps the question of whether 3x-ui should add an encryption-at-rest layer for secret settings.

Alternatives you've considered

  1. Static external Clash YAML — host a separate .yaml and point Meta at it. Works but creates two sources of truth: node names, ports, and credentials change in 3x-ui while the external file remains stale unless manually updated.
  2. Sub-Converter / sub-store middleware — wrap 3x-ui's output and inject proxy-providers at the edge. Adds a component that must be maintained and kept in sync with 3x-ui updates.
  3. Keep using inline mode only — for small setups this is fine, but it breaks as soon as the provider file needs to be updated independently of the panel (which is the common case for shared/mirrored provider lists).
  4. Forking the panel — embedding the fix in a personal fork is possible but creates long-term merge debt with upstream.

Concrete use case

An operator manages ~120 clients across 4 inbounds on a single 3x-ui panel. They host a shared proxy-providers/default.yaml on a CDN that aggregates nodes from multiple regional exit servers. The provider file is updated weekly from a private script; each update is age-encrypted with a known public key and the encrypted blob is pushed to the CDN.

They want a single subscription URL per client (https://panel:2096/clash/<sub-id>) that Meta can consume directly — no Sub-Converter, no separate YAML file to maintain. The subscription must carry the age-secret-key so Meta can decrypt the provider file at runtime.

With Part A + Part B, the operator pastes the block above into the panel once. Every client refresh receives the correct config, and when the provider file on the CDN changes, no panel change is needed.

Mockups, screenshots, or examples

Expected YAML output after the fix (inline mode, operator pastes the block):

proxies:
  - { name: "vless-ws-tls-1", type: vless, ... }
  - { name: "vmess-ws-2", type: vmess, ... }
  # ... other per-client proxies ...

proxy-providers:
  default:
    type: http
    url: "https://cdn.example.com/providers/default.yaml"
    path: ./proxy_providers/default.yaml
    interval: 3600
    proxy: DIRECT
    size-limit: 1000000
    age-secret-key: AGE-SECRET-KEY-1ZTQLLN0A4U3ZTT3DCZKYN0CGZEZQLWX2DFTXUWMT4ZHR0N2UG6LSW9NT0N

proxy-groups:
  - name: PROXY
    type: select
    include-all: true
  - name: DIRECT
    type: select
    proxies: [DIRECT]

rules:
  - MATCH,PROXY

With Part A, the same block works when pasted into a remote URL (https://cdn.example.com/routing/clash.yaml) — the remote-source guard no longer drops proxy-providers.

Meta docs reference: https://wiki.metacubex.one/en/config/proxy-providers/#age-secret-key
(mihomo v1.16.x+, supports age-secret-key inside each provider entry; CLI tool mihomo age keygen / mihomo age encrypt / mihomo age decrypt for key management.)

Which parts of the panel would this affect?

Subscription (share links / Clash / JSON)

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @jshir700 on GitHub (Aug 29, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6363 ### Is your feature request related to a problem? When 3x-ui's Clash subscription is used with Meta/Mihomo clients that rely on **remote proxy-provider files** (e.g. a CDN-hosted `providers/default.yaml` that is updated independently), operators currently have no native path to express that dependency through the panel. The two ways to inject a `proxy-providers:` block today both fall short for this workflow: **Inline mode (currently the only working path)** — paste the full provider YAML directly into the panel's "Global routing rules" field. This works for small, static provider lists but breaks the common case where the provider file is hosted on a CDN and updated independently. More critically, because `mergeClashRulesYAML` copies every top-level key except `rules` verbatim (`clash_service.go:808-817`), any top-level key the operator pastes **replaces** the panel-generated one. Pasting a full `proxy-groups:` block wipes the panel's auto-generated groups (including `PROXY` and `DIRECT`). Operators must therefore also restate every proxy-group — including `include-all: true` or an explicit `proxies:` list — inside the pasted block, which defeats the purpose of a centrally-managed subscription. **Remote mode (the intended path for large/CDN-backed setups)** — point the "Global routing rules" field at a remote URL. Here `proxy-providers` is **silently dropped**: `remoteClashAllowedKey()` only returns true for `proxy-groups`, `rule-providers`, and `rules` (`clash_service.go:911-918`), and `validateRemoteClashValue` enforces this with the comment `remote Clash proxy-group %q cannot use proxy-providers` (`clash_service.go:890`). This guard was introduced in #5044 / #5054 to prevent a compromised remote source from injecting arbitrary proxies into every client's profile. It is correct for untrusted sources but too strict for the operator's own CDN — the operator controls both ends and the guard adds no real protection in that scenario. The net result: operators who want a single 3x-ui subscription URL that also carries a reference to a remote, optionally age-encrypted provider file either (a) maintain a separate static Clash YAML outside the panel (two sources of truth), or (b) embed the full inline config and restate every proxy-group on every update. ### Describe the solution you'd like ### Part A — Relax the remote-source guard for `proxy-providers` When the Clash routing source is a **remote URL**, extend the allowed-key set so that `proxy-providers` is accepted alongside `proxy-groups`, `rule-providers`, and `rules`. Mirror the existing validation pattern for `rule-providers` (verify each entry is a named map with required fields). Reject groups that reference `use` from a remote source (the current safety check stays) — only relax the key-allowlist itself. This keeps the security boundary: a remote source still cannot inject arbitrary proxies into the generated profile. It can only declare *where the provider files live*; the actual proxy contents come from the operator's CDN, not from the routing YAML. Code change sketch: ```go func remoteClashAllowedKey(key string) bool { switch key { case "proxy-groups", "rule-providers", "proxy-providers", "rules": return true default: return false } } func validateRemoteClashValue(key string, value any) error { switch key { // ... existing cases ... case "proxy-providers": providers, ok := value.(map[string]any) if !ok { return fmt.Errorf("remote Clash proxy-providers must be a map") } for name, provider := range providers { if strings.TrimSpace(name) == "" { return fmt.Errorf("remote Clash proxy-provider name must not be empty") } if _, ok := provider.(map[string]any); !ok { return fmt.Errorf("remote Clash proxy-provider %q must be a map", name) } } } return nil } ``` Then in `mergeRemoteClashRules`, handle the new case like `rule-providers`: ```go case "proxy-providers": providers, _ := value.(map[string]any) base["proxy-providers"] = providers ``` ### Part B — Document the inline path as the supported route for `age-secret-key` The `age-secret-key` field is a **per-provider** field inside the `proxy-providers` map in the Meta spec ([docs](https://wiki.metacubex.one/en/config/proxy-providers/#age-secret-key), minimum Meta v1.16.x). It works only when the provider YAML is emitted inline in the subscription — the remote source path cannot carry it because `proxy-providers` is rejected at the remote-allowlist stage (Part A above fixes this, but the inline path is simpler for operators who host small provider files themselves). Document that operators should paste a complete config block (including `proxy-groups` with `include-all: true` or an explicit `proxies:` list) into the inline "Global routing rules" field when using `age-secret-key`. Provide a ready-to-copy template in the UI or docs: ```yaml proxy-providers: default: type: http url: "https://cdn.example.com/providers/default.yaml" path: ./proxy_providers/default.yaml interval: 3600 proxy: DIRECT size-limit: 1000000 age-secret-key: AGE-SECRET-KEY-1ZTQLLN0A4U3ZTT3DCZKYN0CGZEZQLWX2DFTXUWMT4ZHR0N2UG6LSW9NT0N proxy-groups: - name: PROXY type: select include-all: true rules: - MATCH,PROXY ``` Note: the panel should warn (or pre-fill) the `proxy-groups` block when `proxy-providers` is detected in the inline input, to prevent operators from accidentally wiping generated groups. ### What is intentionally NOT in scope - **Panel-side age encryption** — having 3x-ui encrypt the provider file before serving it is not part of this request. The provider file lives on the operator's CDN; the operator encrypts it server-side (e.g. via `mihomo age encrypt <public_key> <source> <target>`) and hosts the encrypted result. 3x-ui only needs to emit the `age-secret-key` field so clients can decrypt it. - **Encryption-at-rest for the setting** — the value lives in the operator's inline YAML, not in a panel setting. This sidesteps the question of whether 3x-ui should add an encryption-at-rest layer for secret settings. ### Alternatives you've considered 1. **Static external Clash YAML** — host a separate `.yaml` and point Meta at it. Works but creates two sources of truth: node names, ports, and credentials change in 3x-ui while the external file remains stale unless manually updated. 2. **Sub-Converter / sub-store middleware** — wrap 3x-ui's output and inject `proxy-providers` at the edge. Adds a component that must be maintained and kept in sync with 3x-ui updates. 3. **Keep using inline mode only** — for small setups this is fine, but it breaks as soon as the provider file needs to be updated independently of the panel (which is the common case for shared/mirrored provider lists). 4. **Forking the panel** — embedding the fix in a personal fork is possible but creates long-term merge debt with upstream. ### Concrete use case An operator manages ~120 clients across 4 inbounds on a single 3x-ui panel. They host a shared `proxy-providers/default.yaml` on a CDN that aggregates nodes from multiple regional exit servers. The provider file is updated weekly from a private script; each update is age-encrypted with a known public key and the encrypted blob is pushed to the CDN. They want a single subscription URL per client (`https://panel:2096/clash/<sub-id>`) that Meta can consume directly — no Sub-Converter, no separate YAML file to maintain. The subscription must carry the `age-secret-key` so Meta can decrypt the provider file at runtime. With Part A + Part B, the operator pastes the block above into the panel once. Every client refresh receives the correct config, and when the provider file on the CDN changes, no panel change is needed. ### Mockups, screenshots, or examples Expected YAML output after the fix (inline mode, operator pastes the block): ```yaml proxies: - { name: "vless-ws-tls-1", type: vless, ... } - { name: "vmess-ws-2", type: vmess, ... } # ... other per-client proxies ... proxy-providers: default: type: http url: "https://cdn.example.com/providers/default.yaml" path: ./proxy_providers/default.yaml interval: 3600 proxy: DIRECT size-limit: 1000000 age-secret-key: AGE-SECRET-KEY-1ZTQLLN0A4U3ZTT3DCZKYN0CGZEZQLWX2DFTXUWMT4ZHR0N2UG6LSW9NT0N proxy-groups: - name: PROXY type: select include-all: true - name: DIRECT type: select proxies: [DIRECT] rules: - MATCH,PROXY ``` With Part A, the same block works when pasted into a **remote** URL (`https://cdn.example.com/routing/clash.yaml`) — the remote-source guard no longer drops `proxy-providers`. Meta docs reference: https://wiki.metacubex.one/en/config/proxy-providers/#age-secret-key (mihomo v1.16.x+, supports `age-secret-key` inside each provider entry; CLI tool `mihomo age keygen` / `mihomo age encrypt` / `mihomo age decrypt` for key management.) ### Which parts of the panel would this affect? Subscription (share links / Clash / JSON) ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [x] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Aug 29, 2026):

Part B needs no code at all — the inline path already emits a per-provider age-secret-key today, and has since v3.3.0 — so the only genuinely open ask here is Part A, and in the shape proposed it does not preserve the boundary you say it preserves. Details below, including the two smaller pieces of this request that do look worth doing.

Your three line references are accurate against the current default branch: mergeClashRulesYAML at internal/sub/clash_service.go:808-817, remoteClashAllowedKey at :911-918, and the use: rejection at :890.

Part B — already works, no panel change required

mergeClashRulesYAML copies every top-level key except rules into the generated config verbatim:

// internal/sub/clash_service.go:808-817
	case map[string]any:
		for key, value := range typed {
			if key == "rules" {
				if ruleList, ok := asAnySlice(value); ok {
					mergeClashRules(base, ruleList)
				}
				continue
			}
			base[key] = value
		}

The value goes to marshalClashYAML unchanged (internal/sub/clash_service.go:114 → internal/sub/clash_yaml.go:87-89, which only quotes YAML-ambiguous scalars). Nothing in the repo inspects the field — grep -rni "age-secret" over internal/, frontend/src, docs/content and docs/lib returns no hits — so whether mihomo wants it per-provider or top-level, the panel passes it through either way. That loop landed in 98ba8803 "fix(subClashService): improve merging of clash rules in YAML (#5054)"; git tag --contains 98ba8803 gives v3.3.0 as the first release carrying it.

To use it: Settings → Subscription → the "Clash / Mihomo" tab, enable subClashEnableRouting, and paste into the "Global routing rules" field (subClashRules, frontend/src/pages/settings/SubscriptionGeneralTab.tsx:363-377). A multi-line value is always treated as inline — ParseRemoteRoutingURL returns remote=false for anything containing a newline or not starting with https:// (internal/util/common/url.go:30-36).

Two caveats, both a direct consequence of base[key] = value:

  1. Never paste a proxies: key — it replaces the client's own generated nodes.
  2. Pasting proxy-groups replaces the generated group block (built at internal/sub/clash_service.go:91-99), which is why your template needs include-all: true or an explicit list. Note the remote path does not behave this way: it merges groups by name and keeps the rest (mergeClashProxyGroups, :1021-1054).

One thing worth knowing before you rely on it: the inline path runs no validation. validateClashRouteGraph is called only from mergeRemoteClashRules (:850), so an inline typo — a rule pointing at a group you deleted, a group referencing a proxy that does not exist — is emitted as-is and fails client-side. Also, subClashRules is a single global setting (internal/web/service/setting.go:117), so one pasted age-secret-key goes to every subscriber of the panel.

Part A — the guard does not survive the relaxation as sketched

The exclusion is deliberate and pinned by tests, not an oversight. TestMergeRemoteClashRulesPreservesGeneratedProxies (internal/sub/remote_routing_test.go:438) feeds a hostile document and asserts:

// internal/sub/remote_routing_test.go:482-484
	if _, exists := base["proxy-providers"]; exists {
		t.Fatal("remote proxy-providers were imported")
	}

and that fixture is already the exact shape your proposal would enable — proxy-providers: at :450-452 next to a group VPN with include-all: true at :460-463.

That combination is the problem. Your proposal keeps the use: rejection as the safety check, but validateClashRouteGraph only checks a group's explicit proxies: list and skips any group that has no such key:

// internal/sub/clash_service.go:948-951
		refs, exists := group["proxies"]
		if !exists {
			continue
		}

A remote group with include-all: true therefore passes validation untouched today (the fixture above proves it — the merge succeeds and the VPN group survives, :496-499). With proxy-providers allowed, that group's membership would be decided by a file the panel never fetches or sees, and a MATCH,VPN rule from the same remote document routes every client through it. So the use: guard alone does not hold the line; whoever controls the routing YAML would again control where clients' proxies come from — which is exactly what mergeRemoteClashRules's doc comment says it exists to prevent (:825-826, "lets remote update only the route graph").

The other half is that your stated use case does not need Part A. The inline block carries only the provider url, path, interval and age-secret-key — none of which change when the CDN file is regenerated weekly, because the client fetches that file, not the panel. "When the provider file on the CDN changes, no panel change is needed" is already true of the inline path. Part A buys exactly one thing: changing which provider URL is referenced without logging into the panel.

Two implementation notes if the maintainer takes it anyway:

  • The third snippet in your sketch is redundant — mergeRemoteClashRules already ends in default: base[key] = value (:846-848), which is how rule-providers gets in.
  • Relaxing remoteClashAllowedKey changes the decision in a second place: normalizeClashRouting uses the same function to decide whether a fetched document has any usable key at all (internal/sub/remote_routing.go:433-442), so a providers-only document would start being cached and accepted too.

One correction on the history

The remote-source guard is not from #5044 / #5054. Those are the June inline-merge change (98ba8803, 2026-06-08) — the one that makes Part B work. The remote path and its allowlist arrived in 380aff4d "Add remote routing URL support (#6168)" (2026-08-18); git tag --contains 380aff4d gives v3.7.0, so the guard is about a week old in released terms.

What looks worth doing from this request

The two small pieces, both grounded in base[key] = value:

  1. The panel warning you suggest — flag it in the UI when the inline value contains proxies: or a proxy-groups:/proxy-providers: block, since neither the frontend nor mergeClashRulesYAML gives any feedback that a generated key was just replaced.
  2. Documentation — there is currently none. grep -rn "subClashRules\|routing source" docs/content/docs/en returns nothing; docs/content/docs/en/config/subscription.mdx:49 mentions /clash/ only as an output format. The in-panel description is the only place it is described at all, and it says "imports only groups/providers/rules" (internal/web/translation/en-US.json:1314), where "providers" means rule-providers — worth disambiguating there too.
  • #6362 — your earlier request, closed; this one supersedes it. Keeping this one open.
  • #5889 (open) — broader Clash/Mihomo profile templating; overlaps with the proxy-groups side but not with the remote allowlist. Not a duplicate.

Verdict: Feature request

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5464031392 --> @github-actions[bot] commented on GitHub (Aug 29, 2026): Part B needs no code at all — the inline path already emits a per-provider `age-secret-key` today, and has since **v3.3.0** — so the only genuinely open ask here is Part A, and in the shape proposed it does not preserve the boundary you say it preserves. Details below, including the two smaller pieces of this request that do look worth doing. Your three line references are accurate against the current default branch: `mergeClashRulesYAML` at `internal/sub/clash_service.go:808-817`, `remoteClashAllowedKey` at `:911-918`, and the `use:` rejection at `:890`. ## Part B — already works, no panel change required `mergeClashRulesYAML` copies every top-level key except `rules` into the generated config verbatim: ```go // internal/sub/clash_service.go:808-817 case map[string]any: for key, value := range typed { if key == "rules" { if ruleList, ok := asAnySlice(value); ok { mergeClashRules(base, ruleList) } continue } base[key] = value } ``` The value goes to `marshalClashYAML` unchanged (`internal/sub/clash_service.go:114` → `internal/sub/clash_yaml.go:87-89`, which only quotes YAML-ambiguous scalars). Nothing in the repo inspects the field — `grep -rni "age-secret"` over `internal/`, `frontend/src`, `docs/content` and `docs/lib` returns no hits — so whether mihomo wants it per-provider or top-level, the panel passes it through either way. That loop landed in `98ba8803` *"fix(subClashService): improve merging of clash rules in YAML (#5054)"*; `git tag --contains 98ba8803` gives `v3.3.0` as the first release carrying it. To use it: **Settings → Subscription → the "Clash / Mihomo" tab**, enable `subClashEnableRouting`, and paste into the **"Global routing rules"** field (`subClashRules`, `frontend/src/pages/settings/SubscriptionGeneralTab.tsx:363-377`). A multi-line value is always treated as inline — `ParseRemoteRoutingURL` returns `remote=false` for anything containing a newline or not starting with `https://` (`internal/util/common/url.go:30-36`). Two caveats, both a direct consequence of `base[key] = value`: 1. Never paste a `proxies:` key — it replaces the client's own generated nodes. 2. Pasting `proxy-groups` replaces the generated group block (built at `internal/sub/clash_service.go:91-99`), which is why your template needs `include-all: true` or an explicit list. Note the remote path does *not* behave this way: it merges groups by name and keeps the rest (`mergeClashProxyGroups`, `:1021-1054`). One thing worth knowing before you rely on it: the inline path runs **no** validation. `validateClashRouteGraph` is called only from `mergeRemoteClashRules` (`:850`), so an inline typo — a rule pointing at a group you deleted, a group referencing a proxy that does not exist — is emitted as-is and fails client-side. Also, `subClashRules` is a single global setting (`internal/web/service/setting.go:117`), so one pasted `age-secret-key` goes to every subscriber of the panel. ## Part A — the guard does not survive the relaxation as sketched The exclusion is deliberate and pinned by tests, not an oversight. `TestMergeRemoteClashRulesPreservesGeneratedProxies` (`internal/sub/remote_routing_test.go:438`) feeds a hostile document and asserts: ```go // internal/sub/remote_routing_test.go:482-484 if _, exists := base["proxy-providers"]; exists { t.Fatal("remote proxy-providers were imported") } ``` and that fixture is already the exact shape your proposal would enable — `proxy-providers:` at `:450-452` next to a group `VPN` with `include-all: true` at `:460-463`. That combination is the problem. Your proposal keeps the `use:` rejection as the safety check, but `validateClashRouteGraph` only checks a group's explicit `proxies:` list and skips any group that has no such key: ```go // internal/sub/clash_service.go:948-951 refs, exists := group["proxies"] if !exists { continue } ``` A remote group with `include-all: true` therefore passes validation untouched today (the fixture above proves it — the merge succeeds and the `VPN` group survives, `:496-499`). With `proxy-providers` allowed, that group's membership would be decided by a file the panel never fetches or sees, and a `MATCH,VPN` rule from the same remote document routes every client through it. So the `use:` guard alone does not hold the line; whoever controls the routing YAML would again control where clients' proxies come from — which is exactly what `mergeRemoteClashRules`'s doc comment says it exists to prevent (`:825-826`, *"lets remote update only the route graph"*). The other half is that your stated use case does not need Part A. The inline block carries only the provider `url`, `path`, `interval` and `age-secret-key` — none of which change when the CDN file is regenerated weekly, because the client fetches that file, not the panel. "When the provider file on the CDN changes, no panel change is needed" is already true of the inline path. Part A buys exactly one thing: changing *which* provider URL is referenced without logging into the panel. Two implementation notes if the maintainer takes it anyway: - The third snippet in your sketch is redundant — `mergeRemoteClashRules` already ends in `default: base[key] = value` (`:846-848`), which is how `rule-providers` gets in. - Relaxing `remoteClashAllowedKey` changes the decision in a second place: `normalizeClashRouting` uses the same function to decide whether a fetched document has any usable key at all (`internal/sub/remote_routing.go:433-442`), so a providers-only document would start being cached and accepted too. ## One correction on the history The remote-source guard is not from #5044 / #5054. Those are the June inline-merge change (`98ba8803`, 2026-06-08) — the one that makes Part B work. The remote path and its allowlist arrived in `380aff4d` *"Add remote routing URL support (#6168)"* (2026-08-18); `git tag --contains 380aff4d` gives `v3.7.0`, so the guard is about a week old in released terms. ## What looks worth doing from this request The two small pieces, both grounded in `base[key] = value`: 1. The panel warning you suggest — flag it in the UI when the inline value contains `proxies:` or a `proxy-groups:`/`proxy-providers:` block, since neither the frontend nor `mergeClashRulesYAML` gives any feedback that a generated key was just replaced. 2. Documentation — there is currently none. `grep -rn "subClashRules\|routing source" docs/content/docs/en` returns nothing; `docs/content/docs/en/config/subscription.mdx:49` mentions `/clash/` only as an output format. The in-panel description is the only place it is described at all, and it says *"imports only groups/providers/rules"* (`internal/web/translation/en-US.json:1314`), where "providers" means `rule-providers` — worth disambiguating there too. ## Related - #6362 — your earlier request, closed; this one supersedes it. Keeping this one open. - #5889 (open) — broader Clash/Mihomo profile templating; overlaps with the proxy-groups side but not with the remote allowlist. Not a duplicate. Verdict: Feature request *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4318
No description provided.