wangjia
|
6f232d4043
|
fix(routing): 堵住 ip_cidr direct 旁路系统层 + 客户端保存失败可见提示
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 25s
ci-pangolin / Cleartext Scan — Android 禁明文 (push) Successful in 19s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 18s
ci-pangolin / Golden — 视觉回归 (全量:components/auth/desktop/tablet) (push) Failing after 13m6s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 13m16s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Failing after 13m25s
ci-pangolin / Go — build + test (push) Failing after 13m35s
ci-pangolin / DS-flow — 原型/跨端同源/代码色单源闸 (push) Failing after 13m45s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Failing after 13m54s
ci-pangolin / Flutter — analyze + test (push) Failing after 14m5s
ci-pangolin / OpenAPI Sync Check (push) Failing after 14m16s
ci-pangolin / Lint — shellcheck (push) Failing after 14m27s
分支审核发现两处 Important,合并前修复。
① [安全] direct 的 ip_cidr 用户规则可自伤式旁路整条隧道:
Validate 原先只校 CIDR 语法。用户提交 ip_cidr=0.0.0.0/0 action=direct
(或 172.16.0.0/12,含隧道 DNS 172.19.0.2)会并入 TUN 入站
route_exclude_address(OS/auto_route 层,位于系统强制层之下),被排除的
流量根本不进 sing-box → hijack-dns 与整条隧道被静默旁路,违反「系统层
用户不可越」铁律。
- Validate: direct 的 ip_cidr 拒绝 catch-all(/0)及与保留段 172.16.0.0/12
重叠(写入闸)。
- clientconfig 渲染层:新增 routing.SafeToExclude 守卫,只有安全的 direct
ip_cidr 才并入 route_exclude_address(纵深防护,兜底写入闸之前的历史坏行)。
- 测试 TestValidateDirectIPCIDRReservedGuard 钉死:拒 catch-all/隧道段重叠、
放行 proxy catch-all 与不重叠 direct。
② [健壮性] 客户端保存失败静默回滚 + 抛未捕获异步异常 + 对话框无字段校验:
_persist 失败会 rethrow(约定调用方 catch),但屏幕层所有回调
(setMode/setBuiltin/addRule/removeRule/reorder/resetToDefault)均未 catch,
规则闪现即消失、无提示,且 rethrow 变 zone 未处理异常。
- 新增 _guardSave 守卫:await + 失败弹 SnackBar(AuthApiException 显服务端
双语文案含校验错,其余回退通用「保存失败」),包裹全部变更类回调。
- 添加规则对话框:_valueError 字段级预校验(ip_cidr 用 InternetAddress
校验、geo 白名单仅 cn),非法即禁用保存并内联红字提示;语义级(保留段)
仍由服务端权威判定经 SnackBar 呈现。
- l10n 单源新增 routingSaveFailed / routingRuleValueInvalid(6 语),regen。
go test ./... 全绿;flutter analyze 无 error;flutter test 265 全过无 golden 回归;
codegen 幂等、原型 i18n 无漂移。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A79VtQA1BwTuQN1ThpvYpo
|
2026-08-01 00:32:52 +08:00 |
|
wangjia
|
2930d76cf3
|
feat(routing): 域名级系统锁冲突提示 + 重置默认按钮 + 客户端 follow-up 清理
承接 FT-A(GET /v1/me/routing 含只读 system_locked_domains)。
- RoutingProfile 加只读 systemLockedDomains(fromJson 读/toJson 不输出);
routing_screen 冲突检测扩展到域名类规则(domain/domain_suffix/domain_keyword
命中锁定域名 → systemLocked),ip_cidr 私网启发式保留。
- RoutingProfile.defaults() + RoutingProfileNotifier.resetToDefault()(复用
_persist:乐观更新/失败回滚/存成功后自动重连,保留只读 systemLockedDomains
不丢)+ routing_screen 加「重置默认」按钮与二次确认弹层(新增 3 个 l10n 键)。
- RoutingRule.copyWith 用哨兵支持 note 显式清空为 null;RoutingRule/Builtin/
RoutingProfile 加值相等 operator==/hashCode。
- T8 smartRouteSub 清理:grep 全仓发现 design/prototype/i18n/alias.json →
gen_proto_i18n.mjs(CI 漂移闸)仍有活引用,按计划口径不删,详见
.superpowers/sdd/task-FTB-report.md。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
2026-07-29 06:57:58 +08:00 |
|
wangjia
|
d73b6da110
|
feat(routing): 分流规则子屏 UI(模式/内置/我的规则/添加/冲突提示)
- 新增 RoutingScreen(ConsumerWidget):代理模式段选(全局/智能/直连)→setMode、
内置规则卡(国内直连开关 + LAN 强制锁定行)、我的规则 ReorderableListView
(拖动排序→reorder、删除→removeRule)、添加规则弹层(类型 chip + 目标输入 +
动作段选→addRule)、FINAL 兜底行。非智能分流模式「我的规则」区灰化+忽略提示。
- 冲突提示:①同 type+value 被更靠前规则遮蔽 →「已被上面规则覆盖」(纯本地计算);
②自定义 ip_cidr 规则落在私网/回环地址段 → 系统锁定提示(启发式,详见文件头注释
——真正的私有服务域名清单未经 API 下发给客户端,是已知缺口)。
- l10n 新增 9 个 key(routingTypeDomain/DomainKeyword/IpCidr/Geoip、
routingRuleShadowed、routingModeNote、routingRuleValueHint、routingNoRules),
经 design/i18n/strings.json 单源 + gen_l10n_dart.mjs 生成六语。
- 补生成 pangolin_icons.dart 的 plus 图标(design/prototype/icons.js 已有,
codegen 之前未跑过)。
- 新增 widget 测试 test/widget/routing_screen_test.dart:模式段选/规则行/添加
按钮可见、非智能模式灰化、重复规则遮蔽提示,共 3 例。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
2026-07-28 08:51:40 +08:00 |
|