fix(proxy): 青果检测改真探并按供应商分码,三面收口凭据外漏与「无法判定」

用户报「青果也要加检测」,往下挖出四层假象,一次收口:

- 后端:probeProxy 的青果短路(过去无条件回「提取成功(青果隧道端点,连接鉴权在客户端)」,
  依据的注释已过期——存下来的链接里就带 key/pwd)删掉,改成真打一次提取,按供应商返回码
  分档出独立 check_code:channel_busy / invalid_key / forbidden / rate_limited /
  insufficient_balance / tunnel_unverified。文案出口一律抹 key/pwd。
- 后端:巡检遇 channel_busy 不落库也不推通知。通道被占不是「密钥坏了」而是「此刻问不出
  结论」,而巡检自己那一发真提取就要占掉唯一一条通道——落库等于把用户早上看到的
  「代理异常」写成我们自己造成的。
- 后端:余量口径按供应商分档。青果账号此前会落进「否则查平台套餐」那条,界面显示的是
  别人家的 jikip 余量(串档);青果不提供可鉴权的余量/余额查询(余额接口是控制台
  appid/appkey 签名档),这一档宁可返回「查不了」也不借极客的数。
- 后端:SecretMasking.maskProxy 的脏值回落不再套 mask()——它保后 4 字符,而青果的 pwd=
  恰好挂在末尾,等于把口令尾 4 位交给界面与日志;改成只交「像 host 的那一段」。
- 用户端:去掉「青果账密直连,无需检测」的 disabled 例外,未保存账密现拼链接送检;
  「无法判定」回落改成后端文案原样显示+可重试语义;代理卡不再套 LLM 渠道字典
  (「龙抬头」错标的真根因就在这行)。
- 后管:货源标签拆成两张互不相通的字典,代理列只读 masked 且不回落到原文,删掉
  user-select:all 的全选复制旁路,「修改代理」改成重填 Authkey/Authpwd 的弹窗。

判据:SecretMaskingTest(5)、UserProxyBalanceServiceTest(6)、UserApiSecretServiceTest
(+1 巡检不落库)、UserApiSecretCheckServiceTest(+138 行分码)、ProxyLinkKeyTest、
用户端 node 5 支+mount 10 支、后管 node 9 支+mount 8 支。后端整量 5187/0 失败,
full 闸门四面绿。
This commit is contained in:
2026-11-02 15:18:41 +08:00
parent 7f5437d012
commit 7e64c12dd6
24 changed files with 2062 additions and 204 deletions
@@ -33,7 +33,7 @@ public final class SecretMasking {
try {
URI uri = URI.create(value.trim());
if (uri.getHost() == null || uri.getHost().isBlank()) {
return mask(value);
return hostOnlyOrHidden(value);
}
StringBuilder masked = new StringBuilder();
masked.append(uri.getScheme() == null ? "http" : uri.getScheme()).append("://");
@@ -46,7 +46,37 @@ public final class SecretMasking {
}
return masked.toString();
} catch (Exception ex) {
return mask(value);
return hostOnlyOrHidden(value);
}
}
/**
* 解析不出 host 的代理串(无 scheme 的 {@code host/get?key=..&pwd=..}、脏值、纯凭据串)走这里。
*
* <p>不能套 {@link #mask}:它保前 4 <b>和后 4</b>,而青果链接的 {@code pwd=} 就挂在末尾——
* 那等于把口令尾 4 位交给界面与日志(2026-11-02 后管「密钥管理」列的残余外漏形状)。
* 这里只肯交出「像 host 的那一段」,其余一个字符都不给。</p>
*/
private static String hostOnlyOrHidden(String value) {
String text = value.trim();
int scheme = text.indexOf("://");
String rest = scheme >= 0 ? text.substring(scheme + 3) : text;
int at = rest.lastIndexOf('@');
if (at >= 0) {
rest = rest.substring(at + 1);
}
int cut = rest.length();
for (char boundary : new char[]{'/', '?', '#'}) {
int index = rest.indexOf(boundary);
if (index >= 0) {
cut = Math.min(cut, index);
}
}
String host = rest.substring(0, cut);
// 没有点号的不认 host(多半是裸凭据),带 = 的更可能是整串 query
if (host.isBlank() || !host.contains(".") || host.contains("=")) {
return "****";
}
return "****" + host;
}
}