用ai补充了一下语言包 - #755
Open
lietxia wants to merge 11 commits into
Open
用ai补充了一下语言包#755lietxia wants to merge 11 commits into
lietxia wants to merge 11 commits into
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
另外用ai检测了一下安全+性能。看不懂。
总体评估
一、安全问题
🔴 S1 — 日志明文打印敏感凭据
文件:
lib/src/setting/user_setting.dart:64ipbMemberId和ipbPassHash是 E-Hentai 会话 Cookie,等同于登录凭据。调试日志在 release 模式下默认仍可被写入设备存储并上报。修复: 不要在日志中打印认证相关字段,或用占位符替代:
🔴 S2 — 密码仅用 MD5 哈希(弱哈希)
文件:
lib/src/setting/security_setting.dart:111MD5 为已损坏的哈希算法,无加盐,可被彩虹表秒破。且哈希值还被写入 debug 日志。
修复: 使用带盐的 PBKDF2 / bcrypt / Argon2(可用
pointycastle包),并移除日志打印。🟡 S3 — 正则表达式注入(用户输入直接构建 RegExp)
文件 1:
lib/src/pages/download_search/download_search_logic.dart:155文件 2:
lib/src/service/local_block_rule_service.dart:505虽然代码对构建 RegExp 有 try/catch 保护(防止崩溃),但恶意/复杂正则仍可造成 ReDoS(正则表达式拒绝服务),导致主线程长时间阻塞。
修复: 在 Isolate 中执行正则匹配,或设置超时:
🟡 S4 — 敏感数据明文存储(get_storage 无加密)
文件:
lib/src/service/storage_service.dart:20GetStorage以 JSON 明文存储在 可见目录(非沙盒私有目录)。ipbPassHash、apiKey(Archive Bot)、encryptedPassword(MD5)等均经此机制持久化。在 root 设备、adb 备份或 macOS 系统上,任何应用均可读取该文件。
修复:
getApplicationSupportDirectory())flutter_secure_storage加密存储🟡 S5 — git 依赖锁定风险(供应链)
文件:
pubspec.yaml多个依赖使用 git URL +
master分支(无版本锁定):其他使用默认默认分支(无 ref)的:
like_button、zoom_view、receive_sharing_intent等。修复: 所有 git 依赖加上
ref: <commit-hash>锁定,防止上游仓库被恶意推送影响构建。🟢 S6 — Archive Bot API Key 日志
文件:
lib/src/setting/archive_bot_setting.dartAPI Key 通过
storageService持久化(同 S4 问题),但未发现在日志中直接打印,风险较低。主要风险是 get_storage 明文存储(见 S4)。二、性能问题
🔴 P1 — build() 中每帧创建 ScrollController(内存泄漏)
文件:
lib/src/pages/read/layout/horizontal_page/horizontal_page_layout.dart:42HorizontalPageLayout继承BaseLayout(StatelessWidget 语义),每次 Obx 触发重建都会创建新的ScrollController且从不 dispose,导致内存持续增长。修复: 将此 Widget 转为
StatefulWidget,在initState中创建,dispose中销毁:🔴 P2 — desktop_layout leftTabBarScrollController 未 dispose
文件:
lib/src/pages/layout/desktop/desktop_layout_page_state.dart:35文件:
lib/src/pages/layout/desktop/desktop_layout_page_logic.dart(onClose 中无 dispose)桌面布局页面生命周期贯穿整个 App 运行时,虽然影响有限,但不符合资源管理规范。
修复: 在
DesktopLayoutPageLogic.onClose()添加:state.leftTabBarScrollController.dispose();🟡 P3 — for 循环内 await 串行执行(批量数据库操作)
文件:
lib/src/service/archive_download_service.dart:339-346文件:
lib/src/service/gallery_download_service.dart:1380-1391(迁移图片时多个串行 await)数据库更新已部分放入
transaction中(是正确的),但_updateArchiveInfoInDisk的磁盘 IO 仍是串行循环。说明: 事务内的串行 await 是正常的(Drift 要求如此)。问题在于事务外的串行磁盘 IO 循环,可改为并发:
🟡 P4 — 用户输入正则在主线程执行(同 S3)
文件:
lib/src/service/local_block_rule_service.dart:505每次画廊列表刷新都对所有条目执行正则匹配,若用户配置了复杂规则且列表条目较多,会在主线程上产生明显卡顿。
修复: 使用
compute()将匹配逻辑移入 Isolate。🟡 P5 — EhCacheManager 未配置内存缓存上限
文件:
lib/src/network/eh_cache_manager.dart未发现
maxNrOfCacheObjects或stalePeriod等缓存限制配置,extended_image使用默认缓存策略,在低内存设备上浏览大量高分辨率图片时可能导致 OOM。修复: 配置合理的缓存限制:
同时为
ExtendedImage传入cacheWidth/cacheHeight缩减内存解码尺寸:🟡 P6 — FutureBuilder 在 build 中使用(重复发起网络请求)
文件:
lib/src/widget/eh_gallery_list_card_.dart:245若父 Widget 频繁重建,
FutureBuilder的future参数会在每次 build 中重新创建,导致请求被重复发起。修复: 将 Future 缓存在 State 中:
🟢 P7 — 搜索建议 ScrollController 无 dispose(低风险)
文件:
lib/src/pages/search/mixin/search_page_state_mixin.dart:34需确认 mixin 的宿主 State 在
dispose中调用了suggestionBodyController.dispose()。若 mixin 无统一 dispose 钩子,存在轻微泄漏风险。三、优先修复建议
四、无明显问题的方面(✅ 通过)
badCertificateCallback绕过appDb.transaction()中comment_page、log_list_page、mobile_layout_page_v2等均在dispose()中正确释放