Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/mobile/test/native-lan-socket.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { readFileSync } from 'node:fs';
import { afterEach, expect, it, vi } from 'vitest';
const state = vi.hoisted(() => ({
available: true,
Expand All @@ -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(?:\s[^>]*)?>[^<]+<\/domain>/gu)].map(
([domain]) => domain,
);
expect(domains).toEqual([
'<domain includeSubdomains="false">encrypted-lan.invalid</domain>',
'<domain includeSubdomains="false">localhost</domain>',
'<domain includeSubdomains="false">127.0.0.1</domain>',
'<domain includeSubdomains="false">10.0.2.2</domain>',
]);
expect(plugin).toContain('<base-config cleartextTrafficPermitted="false" />');
});
afterEach(() => {
vi.clearAllMocks();
state.available = true;
Expand Down
8 changes: 4 additions & 4 deletions apps/mobile/with-lan-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ module.exports = (config) => {
<network-security-config>
<base-config cleartextTrafficPermitted="false" />
<domain-config cleartextTrafficPermitted="true">
<domain>encrypted-lan.invalid</domain>
<domain>localhost</domain>
<domain>127.0.0.1</domain>
<domain>10.0.2.2</domain>
<domain includeSubdomains="false">encrypted-lan.invalid</domain>
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">127.0.0.1</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
</domain-config>
</network-security-config>
`,
Expand Down
11 changes: 11 additions & 0 deletions changes/2599-lan-release-lint.md
Original file line number Diff line number Diff line change
@@ -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))。
Loading