fix(app): 强制 HTTPS — Android 网络安全配置 + 生产默认 HTTPS

- Android: 添加 network_security_config.xml,默认禁止明文流量
- Android: 仅允许 localhost/127.0.0.1/10.0.2.2 明文(开发调试)
- Android: 更新 AndroidManifest 引用网络安全配置
- ApiClient: 默认 URL 改为 https://api.nuanji.app/api/v1
- AppConfig: fromEnvironment 默认值改为 HTTPS 生产地址
- AppConfig: dev 常量保留 localhost(仅用于本地开发)
- iOS: ATS 默认已强制 HTTPS,无需修改

审计 ID: 6b-C01
This commit is contained in:
iven
2026-06-03 10:13:20 +08:00
parent 45949e3ed0
commit a34c9fd176
4 changed files with 41 additions and 10 deletions

View File

@@ -2,7 +2,8 @@
<application
android:label="nuanji_app"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name=".MainActivity"
android:exported="true"

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 网络安全配置 — 强制 HTTPS仅允许 localhost 明文(开发用)
审计 ID: 6b-C01 — Flutter 默认 HTTP 明文传输修复
-->
<network-security-config>
<!-- 生产配置:强制 HTTPS -->
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<!-- 开发配置:允许 localhost/10.0.2.2 明文(模拟器/本地调试)
生产构建时应移除此段 -->
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">127.0.0.1</domain>
</domain-config>
</network-security-config>