Skip to content

AndroidManifest 全局开启 usesCleartextTraffic,WebView 抓取内容可被中间人注入 #44

Description

@yunkst

文件: android/app/src/main/AndroidManifest.xml:18

问题: 全局开启明文 HTTP 流量:android:usesCleartextTraffic="true"

为什么是质量问题:

  • app 的合法网络流量大部分是 HTTPS(GitHub API / Releases、用户自配 LLM HTTPS endpoint),明文豁免只服务于"用户在「后端服务配置」填了 http:// 私有后端"这一场景;
  • app 内置 WebView(flutter_inappwebview)抓取任何小说站点同样默认允许明文(番茄等站的反爬、运营链接跳转都可能走 http),WebView 内容易被中间人注入:可篡改章节正文(让 ContentSanitizer 之后的内容带恶意 HTML/JS/反爬陷阱)、可植入虚假的"章节已更新"提示诱导用户操作;
  • 备份下载、日志上传走用户自配后端,明文是预期的;但 usesCleartextTraffic="true" 是 app 级而非按 host 的——放过了所有流量。

建议:

  1. 改为 android:usesCleartextTraffic="false" + 提供 network_security_config.xml,只在 <domain-config cleartextTrafficPermitted="true"> 段中列出用户配置过的 http host;
  2. 或者使用 trust-anchors 限定只信任系统 CA,避免用户装第三方代理/抓包证书时中间人注入 WebView 流量;
  3. 至少 debug buildType 允许 cleartext、release 关掉。

忽略指南:在 android/app/src/main/AndroidManifest.xml:18 添加注释 <!-- cr-ignore <CR_IGNORE_IID_HASH>: <你的理由 -->,下次审查会自动关闭。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions