fix(sub): drop duplicated fingerprint in external-proxy tlsSettings (#6096)

applyExternalProxyTLSToStream wrote the external proxy fingerprint both to
tlsSettings.fingerprint and to tlsSettings.settings.fingerprint, so the
generated JSON subscription for an XHTTP Host group carried the same
fingerprint twice. Every other field in this function writes a single
location, and tlsData already emits fingerprint at the top level, so keep
only tlsSettings.fingerprint.
This commit is contained in:
n0liu
2026-07-29 04:10:47 +08:00
committed by GitHub
parent a2774bf212
commit 8bbca76bdd
2 changed files with 20 additions and 6 deletions

View File

@@ -1625,12 +1625,6 @@ func applyExternalProxyTLSToStream(ep map[string]any, stream map[string]any, sec
}
if fp, ok := ep["fingerprint"].(string); ok && fp != "" {
tlsSettings["fingerprint"] = fp
settings, _ := tlsSettings["settings"].(map[string]any)
if settings == nil {
settings = map[string]any{}
tlsSettings["settings"] = settings
}
settings["fingerprint"] = fp
}
if alpn, ok := externalProxyALPNList(ep["alpn"]); ok {
tlsSettings["alpn"] = alpn

View File

@@ -775,6 +775,26 @@ func TestApplyExternalProxyTLSToStream_DoesNotLeakAcrossProxies(t *testing.T) {
}
}
func TestApplyExternalProxyTLSToStream_FingerprintNotDuplicated(t *testing.T) {
stream := map[string]any{
"security": "tls",
"tlsSettings": map[string]any{},
}
ep := map[string]any{"dest": "proxy.example.com", "fingerprint": "chrome"}
applyExternalProxyTLSToStream(ep, stream, "tls")
ts, _ := stream["tlsSettings"].(map[string]any)
if ts["fingerprint"] != "chrome" {
t.Fatalf("tlsSettings.fingerprint = %v, want %q", ts["fingerprint"], "chrome")
}
if settings, ok := ts["settings"].(map[string]any); ok {
if got, dup := settings["fingerprint"]; dup {
t.Fatalf("fingerprint must not be duplicated into tlsSettings.settings, got %v", got)
}
}
}
func TestApplyExternalProxyTLSParams_SetsPinnedPeerCert(t *testing.T) {
params := map[string]string{"security": "tls"}
ep := map[string]any{