diff --git a/apps/mobile/test/native-lan-socket.test.ts b/apps/mobile/test/native-lan-socket.test.ts index bb61813df4..29579d28aa 100644 --- a/apps/mobile/test/native-lan-socket.test.ts +++ b/apps/mobile/test/native-lan-socket.test.ts @@ -1,3 +1,4 @@ +import { readFileSync } from 'node:fs'; import { afterEach, expect, it, vi } from 'vitest'; const state = vi.hoisted(() => ({ available: true, @@ -22,6 +23,19 @@ vi.mock('expo', () => ({ : null, })); import { openLanSocket } from '../src/host/native-lan-socket'; +it('keeps Android cleartext exceptions limited to the four exact native transport domains', () => { + const plugin = readFileSync(new URL('../with-lan-channel.js', import.meta.url), 'utf8'); + const domains = [...plugin.matchAll(/]*)?>[^<]+<\/domain>/gu)].map( + ([domain]) => domain, + ); + expect(domains).toEqual([ + 'encrypted-lan.invalid', + 'localhost', + '127.0.0.1', + '10.0.2.2', + ]); + expect(plugin).toContain(''); +}); afterEach(() => { vi.clearAllMocks(); state.available = true; diff --git a/apps/mobile/with-lan-channel.js b/apps/mobile/with-lan-channel.js index 6ca92b1380..c05ec78354 100644 --- a/apps/mobile/with-lan-channel.js +++ b/apps/mobile/with-lan-channel.js @@ -19,10 +19,10 @@ module.exports = (config) => { - encrypted-lan.invalid - localhost - 127.0.0.1 - 10.0.2.2 + encrypted-lan.invalid + localhost + 127.0.0.1 + 10.0.2.2 `, diff --git a/changes/2599-lan-release-lint.md b/changes/2599-lan-release-lint.md new file mode 100644 index 0000000000..a14aac7da1 --- /dev/null +++ b/changes/2599-lan-release-lint.md @@ -0,0 +1,11 @@ +--- +section: Fixed +--- + +## en + +- Fixed Android Release lint rejecting the encrypted LAN network policy by explicitly limiting its four existing exceptions to exact domains ([#2599](https://github.com/BotHarness/DeepSeekBot/issues/2599)). + +## zh + +- 修复 Android Release lint 拒绝加密局域网网络策略的问题,显式将原有四项例外限制为精确域名([#2599](https://github.com/BotHarness/DeepSeekBot/issues/2599))。