Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(market): support router fake-ip sources

vastsa6fc8ad611108
diff --git a/apps/desktop/electron/main/mcp-registry-catalog.ts b/apps/desktop/electron/main/mcp-registry-catalog.ts
index 3ea5d5a78..0f5950ec0 100644
--- a/apps/desktop/electron/main/mcp-registry-catalog.ts
+++ b/apps/desktop/electron/main/mcp-registry-catalog.ts
@@ -15,20 +15,25 @@
* whole catalog regardless of what is cached. One failing source only costs
* itself, and a total outage degrades to the built-in catalog.
*/
+import { net, session } from "electron";
import { lookup } from "node:dns/promises";
import { request as httpsRequest } from "node:https";
import type { IncomingHttpHeaders } from "node:http";
import { isIP } from "node:net";
import {
- isPublicIpLiteral,
+ classifyIpLiteral,
+ classifyProxyRoute,
+ isAcceptableResolvedAddress,
isSafeMarketSourceUrl,
mapRegistryServer,
sanitizeMarketSources,
validateMcpCatalogFile,
type MarketSource,
+ type PublicNetworkRoute,
type RegistryRecord,
type SourcedCatalogEntry,
} from "@pi-desktop/shared";
+import { currentNetworkProxy } from "./network-proxy";
const PAGE_SIZE = 100;
/** First browse paints two pages; every "load more" appends this many. */
@@ -43,7 +48,7 @@ const MAX_CACHE_ENTRIES = 128;
const MAX_MARKET_SOURCES = 16;
const MAX_CACHED_ENTRIES = 2_000;
-type ResolvedAddress = { address: string; family: 4 | 6 };
+type ResolvedAddress = { address: string; family: 4 | 6; route: PublicNetworkRoute };
type PolicyResponse = {
status: number;
headers: { get: (name: string) => string | null };
@@ -80,6 +85,16 @@ function withTimeout<T>(promise: Promise<T>, timeoutMs: number): Promise<T> {
]);
}
+async function resolveProxyRoute(url: string, timeoutMs: number): Promise<PublicNetworkRoute> {
+ try {
+ return classifyProxyRoute(
+ await withTimeout(session.defaultSession.resolveProxy(url), timeoutMs),
+ );
+ } catch {
+ return "unknown";
+ }
+}
+
/**
* Resolve a public hostname once and return the address that must be used for
* the connection. The caller must not resolve the hostname again: doing so
@@ -89,25 +104,39 @@ async function resolvePublicUrl(url: string, timeoutMs: number): Promise<Resolve
if (!isSafeMarketSourceUrl(url)) {
throw new Error("url rejected by the public-network policy");
}
+ const deadline = Date.now() + timeoutMs;
const parsed = new URL(url);
const host = parsed.hostname.toLowerCase().replace(/\.+$/, "");
const literal = host.startsWith("[") ? host.slice(1, -1) : host;
+ const route = await resolveProxyRoute(url, timeoutMs);
+ const remaining = deadline - Date.now();
+ if (remaining <= 0) throw new Error("market source request timed out");
const literalFamily = isIP(literal);
if (literalFamily === 4 || literalFamily === 6) {
- return { address: literal, family: literalFamily };
+ return { address: literal, family: literalFamily, route };
}
- const addresses = await withTimeout(lookup(host, { all: true, verbatim: true }), timeoutMs);
+ const addresses = await withTimeout(
+ lookup(host, { all: true, verbatim: true }),
+ remaining,
+ );
if (!addresses.length) throw new Error(`hostname does not resolve: ${host}`);
+ const allowFakeIp = currentNetworkProxy().allowFakeIp === true;
for (const address of addresses) {
- if (!isPublicIpLiteral(address.address)) {
- throw new Error(`hostname resolves to a non-public address: ${host}`);
+ const addressKind = classifyIpLiteral(address.address);
+ if (
+ !isAcceptableResolvedAddress(addressKind, route) &&
+ !(allowFakeIp && addressKind === "benchmark")
+ ) {
+ throw new Error(
+ `hostname resolves to a non-public address: ${host} -> ${address.address} (${addressKind}, ${route} route)`,
+ );
}
}
const first = addresses[0];
if (first.family !== 4 && first.family !== 6) {
throw new Error(`hostname resolved with an unsupported address family: ${host}`);
}
- return { address: first.address, family: first.family };
+ return { address: first.address, family: first.family, route };
}
/**
@@ -202,10 +231,55 @@ function requestPinnedHttps(
req.end();
});
}
+async function readProxiedResponseBody(response: Response): Promise<string> {
+ const contentLength = Number(response.headers.get("content-length"));
+ if (Number.isFinite(contentLength) && contentLength > MAX_SOURCE_RESPONSE_BYTES) {
+ await response.body?.cancel().catch(() => undefined);
+ throw new Error("market source response is too large");
+ }
+ if (!response.body) {
+ const body = await response.text();
+ if (Buffer.byteLength(body, "utf8") > MAX_SOURCE_RESPONSE_BYTES) {
+ throw new Error("market source response is too large");
+ }
+ return body;
+ }
+ const reader = response.body.getReader();
+ const chunks: Buffer[] = [];
+ let bytes = 0;
+ try {
+ while (true) {
+ const { done, value } = await reader.read();
+ if (done) break;
+ const chunk = Buffer.from(value);
+ bytes += chunk.byteLength;
+ if (bytes > MAX_SOURCE_RESPONSE_BYTES) {
+ await reader.cancel().catch(() => undefined);
+ throw new Error("market source response is too large");
+ }
+ chunks.push(chunk);
+ }
+ return Buffer.concat(chunks).toString("utf8");
+ } finally {
+ reader.releaseLock();
+ }
+}
+// Fetch through the session's proxy stack; the session owns DNS resolution.
+async function requestProxiedHttps(url: string, timeoutMs: number): Promise<PolicyResponse> {
+ const response = await net.fetch(url, {
+ redirect: "manual",
+ signal: AbortSignal.timeout(Math.max(1, timeoutMs)),
+ });
+ return {
+ status: response.status,
+ headers: { get: (name) => response.headers.get(name) },
+ body: await readProxiedResponseBody(response),
+ };
+}
/**
- * Fetch with the public-network policy applied per hop. Manual redirects and
- * pinned addresses ensure every request goes only to an approved public IP.
+ * pinned addresses ensure direct requests go only to an approved public IP;
+ * proxied requests stay inside the session's configured proxy stack.
*/
async function fetchPolicy<T>(url: string, kind: "json" | "text"): Promise<T> {
let current = url;
@@ -214,7 +288,10 @@ async function fetchPolicy<T>(url: string, kind: "json" | "text"): Promise<T> {
const remaining = deadline - Date.now();
if (remaining <= 0) throw new Error("market source request timed out");
const resolved = await resolvePublicUrl(current, remaining);
- const response = await requestPinnedHttps(current, resolved, deadline - Date.now());
+ const response =
+ resolved.route === "proxied"
+ ? await requestProxiedHttps(current, deadline - Date.now())
+ : await requestPinnedHttps(current, resolved, deadline - Date.now());
if (response.status >= 300 && response.status < 400) {
const location = response.headers.get("location");
if (!location) throw new Error("redirect without a location header");
diff --git a/apps/desktop/electron/main/public-https-fetch.ts b/apps/desktop/electron/main/public-https-fetch.ts
index 2d0638a13..e8ccd0047 100644
--- a/apps/desktop/electron/main/public-https-fetch.ts
+++ b/apps/desktop/electron/main/public-https-fetch.ts
@@ -135,8 +135,10 @@ export function createPublicHttpsClient(options: {
lookupImpl?: PublicHttpsLookup;
/** Must be the session that carries `fetchImpl`; absent stays strict. */
routeImpl?: PublicHttpsRouteLookup;
+ /** Permit only benchmark fake-IP answers when the user explicitly opts in. */
+ allowFakeIp?: boolean | (() => boolean);
timeoutMs?: number;
-} ): PublicHttpsClient {
+}): PublicHttpsClient {
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
const lookupImpl =
options.lookupImpl ??
@@ -188,13 +190,18 @@ export function createPublicHttpsClient(options: {
}
for (const address of addresses) {
const addressKind = classifyIpLiteral(address.address);
- if (!isAcceptableResolvedAddress(addressKind, route)) {
+ const allowFakeIp =
+ typeof options.allowFakeIp === "function"
+ ? options.allowFakeIp()
+ : options.allowFakeIp === true;
+ if (
+ !isAcceptableResolvedAddress(addressKind, route) &&
+ !(allowFakeIp && addressKind === "benchmark")
+ ) {
// The class travels with the refusal: `benchmark` is a TUN fake-IP
- // (198.18.0.0/15) and `private` is a real RFC1918 target, and only the
- // class tells those apart in the log and in the panel. The route travels
- // with it too: a fake-IP answer is tolerated on a proxied route because
- // this app never dials it, and refused on a direct or unreadable route
- // because this app would (ADR 0272).
+ // (198.18.0.0/15) and `private` is a real RFC1918 target. The explicit
+ // fake-IP opt-in never changes the verdict for any other non-public
+ // class (ADR 0272).
throw new PublicNetworkPolicyError(
`hostname resolves to a non-public address: ${host} -> ${address.address} (${addressKind}, ${route} route)`,
{ reason: "non-public-address", host, address: address.address, addressKind, route },
diff --git a/apps/desktop/electron/main/skill-market-catalog.ts b/apps/desktop/electron/main/skill-market-catalog.ts
index c6d489ff0..f665347a6 100644
--- a/apps/desktop/electron/main/skill-market-catalog.ts
+++ b/apps/desktop/electron/main/skill-market-catalog.ts
@@ -9,6 +9,7 @@
import { net, session } from "electron";
import type { SkillCatalogEntry, SkillMarketSource } from "@pi-desktop/shared";
import { createPublicHttpsClient } from "./public-https-fetch";
+import { currentNetworkProxy } from "./network-proxy";
import {
createSkillMarketAggregator,
type SkillMarketDocument,
@@ -27,6 +28,7 @@ export { guessSkillCategories } from "./skill-market-scan";
const client = createPublicHttpsClient({
fetchImpl: (url, init) => net.fetch(url, init),
routeImpl: (url) => session.defaultSession.resolveProxy(url),
+ allowFakeIp: () => currentNetworkProxy().allowFakeIp === true,
});
const aggregator = createSkillMarketAggregator(client.request);
diff --git a/apps/desktop/src/components/settings/NetworkProxySection.tsx b/apps/desktop/src/components/settings/NetworkProxySection.tsx
index a4374800f..fa9c6ad4e 100644
--- a/apps/desktop/src/components/settings/NetworkProxySection.tsx
+++ b/apps/desktop/src/components/settings/NetworkProxySection.tsx
@@ -61,7 +61,7 @@ export function NetworkProxySection({
if (mode === saved.mode) return;
setTestState("idle");
if (mode !== "custom") {
- void persist({ mode });
+ void persist({ mode, allowFakeIp: saved.allowFakeIp });
return;
}
const parsed = parseProxyUrl(urlDraft);
@@ -71,6 +71,7 @@ export function NetworkProxySection({
mode: "custom",
url,
bypass: bypassDraft.trim() || undefined,
+ allowFakeIp: saved.allowFakeIp,
});
};
@@ -89,6 +90,7 @@ export function NetworkProxySection({
mode: "custom",
url: parsed.value.href,
bypass: bypassDraft.trim() || undefined,
+ allowFakeIp: saved.allowFakeIp,
});
};
@@ -98,7 +100,7 @@ export function NetworkProxySection({
setBypassDraft(next);
if (next === (saved.bypass ?? DEFAULT_NETWORK_PROXY_BYPASS)) return;
if (!saved.url) return;
- void persist({ mode: "custom", url: saved.url, bypass: next });
+ void persist({ mode: "custom", url: saved.url, bypass: next, allowFakeIp: saved.allowFakeIp });
};
const runTest = async () => {
@@ -110,8 +112,9 @@ export function NetworkProxySection({
mode: "custom",
url: urlDraft.trim() || saved.url,
bypass: bypassDraft.trim() || undefined,
+ allowFakeIp: saved.allowFakeIp,
}
- : { mode: saved.mode };
+ : { mode: saved.mode, allowFakeIp: saved.allowFakeIp };
try {
const result = await api.testNetworkProxy(payload);
if (result.ok) {
@@ -163,6 +166,23 @@ export function NetworkProxySection({
))}
</div>
</SettingsRow>
+ <SettingsRow
+ title={t("settings.proxyFakeIp")}
+ description={t("settings.proxyFakeIpDesc")}
+ >
+ <button
+ type="button"
+ className={cx("settings-toggle", saved.allowFakeIp && "on")}
+ role="switch"
+ aria-checked={saved.allowFakeIp === true}
+ aria-label={t("settings.proxyFakeIp")}
+ onClick={() =>
+ void persist({ ...saved, allowFakeIp: saved.allowFakeIp !== true })
+ }
+ >
+ <span className="settings-toggle-thumb" />
+ </button>
+ </SettingsRow>
{saved.mode === "custom" ? (
<>
diff --git a/apps/desktop/src/lib/settings-search.ts b/apps/desktop/src/lib/settings-search.ts
index 808ceeaa4..4201d94c8 100644
--- a/apps/desktop/src/lib/settings-search.ts
+++ b/apps/desktop/src/lib/settings-search.ts
@@ -71,6 +71,7 @@ export const SETTINGS_NAV: SettingsNavEntry[] = [
"settings.proxyDirect",
"settings.proxyCustom",
"settings.proxyUrl",
+ "settings.proxyFakeIp",
],
},
{
diff --git a/apps/desktop/test/mcp-registry-catalog.test.mjs b/apps/desktop/test/mcp-registry-catalog.test.mjs
index c425ca171..e8bd971bc 100644
--- a/apps/desktop/test/mcp-registry-catalog.test.mjs
+++ b/apps/desktop/test/mcp-registry-catalog.test.mjs
@@ -11,6 +11,18 @@ test("market source requests pin the checked DNS address", () => {
assert.match(source, /servername: isIP\(host\) \? undefined : host/);
assert.match(source, /if \(response\.status >= 300 && response\.status < 400\)/);
});
+test("fake-IP proxy routes use the session transport without weakening direct pinning", () => {
+ assert.match(source, /resolveProxy\(url\)/);
+ assert.match(source, /classifyProxyRoute/);
+ assert.match(source, /isAcceptableResolvedAddress\(addressKind, route\)/);
+ assert.match(source, /resolved\.route === "proxied"/);
+ assert.match(source, /requestProxiedHttps/);
+ assert.match(source, /net\.fetch\(url/);
+ assert.match(source, /requestPinnedHttps\(current, resolved/);
+ assert.match(source, /MAX_SOURCE_RESPONSE_BYTES/);
+ assert.match(source, /currentNetworkProxy\(\)\.allowFakeIp/);
+ assert.match(source, /allowFakeIp && addressKind === "benchmark"/);
+});
test("market source responses and caches are bounded", () => {
assert.match(source, /MAX_SOURCE_RESPONSE_BYTES = 4 \* 1024 \* 1024/);
diff --git a/apps/desktop/test/public-https-fetch-route.test.mjs b/apps/desktop/test/public-https-fetch-route.test.mjs
index 4fd61cfea..a6d3c3321 100644
--- a/apps/desktop/test/public-https-fetch-route.test.mjs
+++ b/apps/desktop/test/public-https-fetch-route.test.mjs
@@ -40,11 +40,12 @@ function response(status, body, location) {
}
/** A client whose session reports `route` and whose resolver answers `address`. */
-function clientFor({ route, address, fetchImpl }) {
+function clientFor({ route, address, fetchImpl, allowFakeIp }) {
return createPublicHttpsClient({
fetchImpl: fetchImpl ?? (async () => response(200, "# skill\n")),
lookupImpl: async () => (address ? [{ address }] : []),
...(route === undefined ? {} : { routeImpl: async () => route }),
+ ...(allowFakeIp === undefined ? {} : { allowFakeIp }),
});
}
@@ -125,6 +126,26 @@ test("a direct route keeps the strict verdict for fake-IP and private answers al
);
}
});
+test("an explicit fake-IP opt-in permits only the benchmark class on a direct route", async () => {
+ const client = clientFor({ route: "DIRECT", address: FAKE_IP, allowFakeIp: true });
+ assert.equal(
+ await client.request("https://cdn.jsdelivr.net/gh/x/SKILL.md", "text"),
+ "# skill\n",
+ );
+
+ const privateClient = clientFor({
+ route: "DIRECT",
+ address: "10.0.0.8",
+ allowFakeIp: true,
+ fetchImpl: async () => {
+ throw new Error("a refused request must never reach the network");
+ },
+ });
+ await assert.rejects(
+ () => privateClient.assertPublicUrl("https://cdn.jsdelivr.net/gh/x/SKILL.md"),
+ (error) => error instanceof PublicNetworkPolicyError && error.addressKind === "private",
+ );
+});
test("a route the transport cannot name falls back to the strict verdict", async () => {
// Fail-closed: no route resolver at all, a resolver that throws, an empty
diff --git a/apps/desktop/test/settings-general.test.mjs b/apps/desktop/test/settings-general.test.mjs
index 51e6d0416..5aec0407d 100644
--- a/apps/desktop/test/settings-general.test.mjs
+++ b/apps/desktop/test/settings-general.test.mjs
@@ -85,6 +85,10 @@ const preloadSource = await readFile(
);
const sharedTypesSource = await readSharedTypesSource();
const stylesSource = await loadStyles();
+const networkProxySource = await readFile(
+ new URL("../src/components/settings/NetworkProxySection.tsx", import.meta.url),
+ "utf8",
+);
test("Basics and AI tabs expose their respective app and AI controls", () => {
const generalStart = settingsPageSource.indexOf('{tab === "general" && settings && (');
@@ -165,10 +169,13 @@ test("language persists as part of shared app settings", () => {
assert.match(sharedTypesSource, /networkProxy\?: NetworkProxySettings/);
});
-test("General Network card persists a custom HTTP or SOCKS5 proxy", () => {
+test("General Network card persists a custom HTTP or SOCKS5 proxy and fake-IP opt-in", () => {
assert.match(settingsPageSource, /<NetworkProxySection /);
+ assert.match(networkProxySource, /settings\.proxyFakeIp/);
+ assert.match(networkProxySource, /allowFakeIp/);
assert.match(settingsSearchSource, /settings\.proxy/);
assert.match(settingsSearchSource, /settings\.proxyCustom/);
+ assert.match(settingsSearchSource, /settings\.proxyFakeIp/);
assert.match(electronMainSource, /applyNetworkProxyFromAppSettings/);
assert.match(electronMainSource, /IPC\.invoke\.networkProxyTest/);
assert.match(protocolSource, /networkProxyTest: "pi-desktop\/network\/testProxy"/);
@@ -181,6 +188,8 @@ test("General Network card persists a custom HTTP or SOCKS5 proxy", () => {
]) {
assert.match(source, /proxyCustom:/);
assert.match(source, /proxyUrlPlaceholder:/);
+ assert.match(source, /proxyFakeIp:/);
+ assert.match(source, /proxyFakeIpDesc:/);
}
});
diff --git a/docs/adr/0245-mcp-market-public-network-boundary.md b/docs/adr/0245-mcp-market-public-network-boundary.md
index 2ecd59189..0c07c9476 100644
--- a/docs/adr/0245-mcp-market-public-network-boundary.md
+++ b/docs/adr/0245-mcp-market-public-network-boundary.md
@@ -23,20 +23,24 @@ than the version the Registry described.
documentation, benchmark, ULA, site-local, IPv4-mapped, and IPv4-compatible
address ranges are rejected, including URL normalization and trailing-dot
forms.
-2. Electron Main resolves every hostname immediately before a request, rejects
- any non-public result, and pins the selected public address to the actual
- HTTPS socket while retaining the original host as TLS SNI and HTTP Host.
- Redirects are manual, HTTPS-only, and revalidated and repinned at every hop,
- with a maximum of five redirects.
-3. Market source responses are bounded to 4 MiB, DNS and HTTP requests share an
+2. Main asks the Electron session carrying each request for its proxy route
+ immediately before connecting. On a `direct` or `unknown` route it resolves
+ every hostname and pins the selected public address to the actual HTTPS
+ socket, retaining the original host as TLS SNI and HTTP Host. On a fully
+ `proxied` route it uses that session's `net.fetch` so system/PAC and custom
+ proxies can resolve fake-IP names; the local resolver's `benchmark` class is
+ tolerated there under ADR 0272, while real private targets remain rejected.
+3. Redirects are manual, HTTPS-only, and revalidated at every hop, with a
+ maximum of five redirects.
+4. Market source responses are bounded to 4 MiB, DNS and HTTP requests share an
eight-second deadline, at most 16 sources are processed per call, and the
in-memory catalog/search caches are bounded.
-4. Registry npm packages are mapped as `identifier@version` and PyPI packages
+5. Registry npm packages are mapped as `identifier@version` and PyPI packages
as `identifier==version` when a version is present. Runtime and package
arguments are preserved in order. Only `streamable-http` remotes with
public HTTPS endpoints are installable; remote header placeholders become
explicit install-form values.
-5. Market HTTP catalog entries are restricted to public HTTPS endpoints. Manual
+6. Market HTTP catalog entries are restricted to public HTTPS endpoints. Manual
user-owned MCP configuration retains the existing local/LAN endpoint policy.
MCP HTTP redirects never forward authorization, cookie, proxy-authorization,
or API-key headers to another origin, and response reading remains bounded
@@ -54,11 +58,11 @@ than the version the Registry described.
- A Registry/catalog entry cannot be used as a market shortcut for a private
MCP endpoint; users can still add such endpoints through the explicit MCP
editor permitted by ADR 0142.
-- Main market requests use pinned Node HTTPS sockets. They do not inherit
- Electron session proxy resolution, so a System-proxy-only environment may
- report a source as unavailable until a proxy-aware pinned dispatcher exists;
- custom HTTP(S) proxy environment support follows the Node runtime. No
- credentials are sent to the market source implicitly.
+- Direct and unknown routes keep pinned Node HTTPS sockets and the strict
+ public-address rule. Fully proxied routes use the Electron session transport;
+ an explicit `allowFakeIp` setting additionally permits only benchmark
+ placeholders for transparent router/TUN deployments. No credentials are sent
+ to the market source implicitly.
## Alternatives considered
diff --git a/docs/adr/0272-connection-time-public-network-route.md b/docs/adr/0272-connection-time-public-network-route.md
index 455d62aab..bb73c1be4 100644
--- a/docs/adr/0272-connection-time-public-network-route.md
+++ b/docs/adr/0272-connection-time-public-network-route.md
@@ -51,12 +51,13 @@ boundary change. This ADR is that change.
of a split-horizon or hostile resolver, and this app cannot see what the proxy
would dial for it.
-3. **`direct` and `unknown` keep the pre-ADR rule byte for byte.** The app dials
- the resolved address itself there, so only `public` passes. `unknown` covers no
- route resolver wired at all, a resolver that throws, an empty or unparsable
- answer, and a list that offers `DIRECT` anywhere — Chromium may fall back to a
- direct connection, so an offered direct hop is never read as proxied. Fail
- closed, exactly as before.
+3. **`direct` and `unknown` keep the pre-ADR rule by default.** The app dials
+ the resolved address itself there, so only `public` passes. An explicit
+ `allowFakeIp` setting may additionally permit the `benchmark` placeholder
+ class for transparent router/TUN deployments; it never permits any other
+ non-public class. `unknown` covers no route resolver wired at all, a resolver
+ that throws, an empty or unparsable answer, and a list that offers `DIRECT`
+ anywhere. Fail closed unless that narrow opt-in is enabled.
4. **The syntactic guard is untouched.** `isSafePublicHttpsUrl` still runs first
for every hop and still refuses non-HTTPS, credential-bearing, non-public
@@ -146,14 +147,14 @@ When to roll this back:
- A proxied or fake-IP user's skill market works: no source is refused for an
address the request would never dial (issue #419).
-- A `direct`-route user keeps the old verdicts, so the change cannot be used to
- reach an internal address by not being behind a proxy.
-- The MCP market is **not** covered by this change. It dials a pinned public
- address with Node HTTPS (ADR 0245), so its guard already checks the address it
- connects to, and it does not consult Chromium's proxy route; a fake-IP
- environment still refuses MCP market sources. Fixing that means giving that
- path a proxy-aware pinned dispatcher, which ADR 0245 already lists as open
- work.
+- A `direct`-route user keeps the old verdicts by default. The explicit
+ `allowFakeIp` opt-in is limited to benchmark placeholders and cannot be used
+ to reach a private, loopback, link-local, or other non-public address.
+- The MCP market now applies the same route-aware verdict before each hop. A
+ fully proxied hop uses the session's `net.fetch`, so a TUN fake-IP answer can
+ reach the configured proxy; direct and unknown hops retain the pinned Node
+ HTTPS path and strict public-address rule. Real private answers remain refused
+ on every route. ADR 0245 defines the MCP-specific transport and body limits.
- A TUN user who configured no proxy the app can see is still refused: the
transport reports `DIRECT` while the local resolver answers fake-IP. That case
is deliberately left strict (clause 3), and its remedy is to enable the system
diff --git a/docs/spec/03-runtime/01-ipc-protocol.md b/docs/spec/03-runtime/01-ipc-protocol.md
index 020bd9e2b..072655cf2 100644
--- a/docs/spec/03-runtime/01-ipc-protocol.md
+++ b/docs/spec/03-runtime/01-ipc-protocol.md
@@ -1528,9 +1528,11 @@ Desktop-only skill market channels (not host RPC) live on Electron IPC:
still return. `failureKinds` maps each name in `failedSources` to `policy`
(the guard judged the target's own non-public address and refused it),
`fake-ip` (it judged a fake-IP placeholder the local proxy invented for the
- name — Clash's `198.18.0.0/15`; still refused on a direct or unreadable route,
- where the guard fails closed and this app would dial that address itself, but a
- condition of the local network rather than a fact about the source),
+ name — Clash's `198.18.0.0/15`; it remains refused on a direct or unreadable
+ route by default, while the explicit `allowFakeIp` setting may permit only
+ the benchmark placeholder for a transparent router/TUN deployment),
+ `unresolved` (the local DNS lookup returned no answer, so no address was
+ judged), or `network`.
`unresolved` (the local DNS lookup returned no answer, so no address was
judged), or `network`.
`failureDetails` carries the same keys with the host that actually failed, the
@@ -1555,10 +1557,12 @@ Desktop-only skill market channels (not host RPC) live on Electron IPC:
Desktop-only MCP market channels (not host RPC) live on Electron IPC:
- `pi-desktop/mcp/market/search` — `{ query?, sources[], more? }` →
- `{ entries, failedSources, exhausted }`. Main validates source URLs, pins
- each resolved public address, follows only bounded HTTPS redirects, and keeps
- cursor state for browse and server-side search. One failed source does not
- discard successful sources; the response and caches are bounded.
+ `{ entries, failedSources, exhausted }`. Main validates source URLs and asks
+ the Electron session for the route on every hop. Fully proxied hops use the
+ session transport; direct and unknown hops pin the resolved public address by
+ default, with explicit `allowFakeIp` limited to benchmark placeholders.
+ Redirects stay bounded HTTPS, browse/search cursors are retained, and one
+ failed source does not discard successful sources; responses and caches are bounded.
### MCP OAuth (ADR 0283)
diff --git a/docs/spec/05-security/01-security.md b/docs/spec/05-security/01-security.md
index 37090f4f9..5a181a364 100644
--- a/docs/spec/05-security/01-security.md
+++ b/docs/spec/05-security/01-security.md
@@ -108,19 +108,28 @@ proxied route the hop is judged on its route rather than on a local address the
app would never dial, so only the resolver-artifact class (`benchmark`, a TUN
fake-IP) is tolerated there, while a direct or unreadable route keeps the full
local classification and rejects loopback, RFC1918, ULA, link-local, mapped
-IPv6, and every other non-public class. Install writes markdown only through
+IPv6, and every other non-public class by default. The explicit `allowFakeIp`
+setting may additionally permit only the `benchmark` placeholder for a
+transparent router/TUN deployment. Install writes markdown only through
`skills.create`. The host document cap remains 128 KiB after sibling markdown
is inlined.
## 4.2 MCP market egress
The MCP market accepts only credentials-free public HTTPS sources and catalog
-endpoints. Main resolves every hostname immediately before connecting and pins
-the selected public address to the HTTPS socket while retaining the original
-host for TLS SNI and HTTP Host. Redirects are manual, HTTPS-only, limited to
-five hops, and checked again before each connection. Responses are capped at
-4 MiB, requests share an 8-second deadline, and source/cache/entry counts are
-bounded. Cross-origin user-MCP redirects do not forward caller headers.
+endpoints. Main asks the same Electron session that carries the request for its
+proxy route before every hop. On a fully `proxied` route, it uses Chromium
+`net.fetch`, which lets system/PAC and custom proxies resolve fake-IP names; the
+local resolver's `benchmark` fake-IP class is tolerated there, while real private
+and other non-public classes remain rejected. On `direct` or `unknown` routes,
+Main keeps the existing Node HTTPS path and pins the selected public address to
+the socket, retaining the original host for TLS SNI and HTTP Host. The explicit
+`allowFakeIp` setting may additionally permit only benchmark answers on those
+routes; it never permits other non-public classes. Redirects are manual,
+HTTPS-only, limited to five hops, and checked again before each connection.
+connection. Responses are capped at 4 MiB, requests share an 8-second
+deadline, and source/cache/entry counts are bounded. Cross-origin user-MCP
+redirects do not forward caller headers.
Manual user-owned MCP configuration remains covered by ADR 0142 and may use
explicit local/LAN endpoints; the market path does not widen that policy.
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index b4905bff8..1eca65450 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -13446,7 +13446,7 @@ plugin-form fixtures in an isolated temporary directory at runtime.
| ID | Scenario | Verification |
|---|---|---|
-| E2E-MCP-MARKET-NET-BOUNDARY | URL guard rejects credentials, loopback, private, special-use IPv4, v4-mapped, ULA, site-local and link-local bypass forms (trailing dot included); Main pins the checked public address and rechecks HTTPS redirects | deterministic guard assertions; source-contract coverage for DNS pin and bounded responses |
+| E2E-MCP-MARKET-NET-BOUNDARY | URL guard rejects credentials, loopback, private, special-use IPv4, v4-mapped, ULA, site-local and link-local bypass forms (trailing dot included); direct/unknown routes pin the checked public address by default, while a fully proxied route uses the session transport and an explicit `allowFakeIp` opt-in can cover transparent-router fake-IP sources without allowing real private answers | deterministic guard assertions; source-contract coverage for DNS pin, proxy route selection, explicit fake-IP scope and bounded responses |
| E2E-MCP-MARKET-SEMANTICS | Registry records map to install templates preserving package versions, named/positional runtime/package arguments and required/optional env variables; a remote header variable is recognized in both the registry's `{name}` and the catalog's `${NAME}` spelling, prompts for declared editable values, preserves unbound brace literals, and resolves header-local defaults, fixed values, and optional flags without merging same-named inputs across headers (ADR registry-header-variable-spelling) | deterministic mapping assertions |
| E2E-MCP-MARKET-INSTALL | Builtin catalog entry resolves through `resolveCatalogEntry` and installs via the host `mcp.upsert` RPC; record lands in `~/.agents/servers/` | real host binary, isolated temp HOME |
| E2E-MCP-MARKET-HEADER-SCOPE | Registry header-local `{token}` resolves only in its header; same-named URL path/query tokens remain literal through mapping, resolution, host upsert/list and persistence. URL templates retain only legacy `${NAME}` substitution. When `headerBindings` exists (even empty or partial), unbound tokens in every header stay literal and never consume another header's input or default | shared regressions plus real host binary with isolated temporary storage; remote entry disabled, no network call |
diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.md
index 6c75083d5..eb22d89eb 100644
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@ -5761,12 +5761,17 @@ that was sitting at the bottom — including after the turn had finished.
On a `proxied` route `isAcceptableResolvedAddress` tolerates only the
resolver-artifact class (`benchmark`); every real internal class and an
unanswered resolver still refuse. A `direct` route keeps the pre-change
- semantics byte for byte, a `DIRECT` entry anywhere in the list is read as
+ semantics by default; an explicit `allowFakeIp` setting may permit only the
+ benchmark placeholder. A `DIRECT` entry anywhere in the list is read as
`unknown` because Chromium may fall back to it, and `unknown` stays strict.
- Refusals and the market's `failureDetails` now carry `route`, so a fake-IP
refusal on a direct route reads apart from one on an unreadable route.
-- The MCP market keeps its pinned Node HTTPS guard (ADR 0245) and is unchanged;
- a fake-IP environment still refuses its sources.
+- The MCP market now asks the Electron session for its route per hop: fully
+ proxied hops use `net.fetch` so fake-IP sources can reach the configured proxy,
+ while direct and unknown hops retain the pinned Node HTTPS guard and strict
+ public-address rule by default. The explicit `allowFakeIp` setting permits
+ only benchmark placeholders for transparent router/TUN deployments; real
+ private answers remain refused. See ADR 0245.
- See ADR 0272, `05-security/01-security.md` §4.1,
`03-runtime/09-logging-and-observability.md`, and
`06-delivery/04-e2e-test-plan.md` E2E-SKILL-MARKET-NET-BOUNDARY.
diff --git a/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md b/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
index 07927847d..7dd47729b 100644
--- a/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
+++ b/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
@@ -1220,7 +1220,7 @@ ASCII slug:frontmatter `name` 能 slugify 时用它,否则 `SKILL.md` 用技
- `pi-desktop/skill/market/search` — `{ query, sources[] }` →
`{ entries, failedSources, failureKinds, failureDetails }`。
主进程聚合目录 JSON 与 GitHub 仓库 SKILL.md 扫描。源 URL 必须通过公网 HTTPS 策略(ADR 0243)。单源失败只丢掉该源。
- `failureKinds` 把 `failedSources` 中的每个名字映射到 `policy`(守卫判定了目标自身的非公网地址并拒绝)、`fake-ip`(判定的是本地代理伪造的 fake-IP 占位地址,如 Clash 默认的 `198.18.0.0/15`;在直连或读不出线路时仍被拒绝,因为守卫在那里失败关闭、这个应用会自己去连该地址,但这是本地网络的状况而不是源的问题)、`unresolved`(本地 DNS 解析没有返回答案,因此没有判定任何地址)或 `network`。`failureDetails` 以同样的键携带真正失败的主机、解析到的地址、守卫自己的 `reason`、地址类别以及判定该地址的线路(`proxied`、`direct`,或传输层读不出线路时的 `unknown`,ADR 0272);面板据此说明**被拒的是什么**(例如「代理把 github.com 应答为 198.18.0.1」),而不只是哪个源没出结果。
+ `failureKinds` 把 `failedSources` 中的每个名字映射到 `policy`(守卫判定了目标自身的非公网地址并拒绝)、`fake-ip`(判定的是本地代理伪造的 fake-IP 占位地址,如 Clash 默认的 `198.18.0.0/15`;在直连或读不出线路时默认仍被拒绝,显式 `allowFakeIp` 只可为透明路由器/TUN 部署放行 benchmark 占位地址)、`unresolved`(本地 DNS 解析没有返回答案,因此没有判定任何地址)或 `network`。`failureDetails` 以同样的键携带真正失败的主机、解析到的地址、守卫自己的 `reason`、地址类别以及判定该地址的线路(`proxied`、`direct` 或传输层读不出线路时的 `unknown`,ADR 0272);面板据此说明**被拒的是什么**,而不只是哪个源没出结果。
判定型拒绝与 fake-IP 拒绝都以 `NETWORK_POLICY_BLOCKED` 暴露(两者都是守卫作出的拒绝),解析器无应答以 `NETWORK_RESOLVE_FAILED` 暴露(spec 08 §3.1);安装面板正是按这些错误码与结构化 `reason` 分类。
- `pi-desktop/skill/market/fetch` — `{ entry }` → `{ name?, description?, body, resources? }`。
主进程按同一策略拉取文档、拆 frontmatter,并可能附上 jsDelivr 目录中的兄弟 `.md`。渲染层通过现有 `skills.create` 安装。该策略即主进程公网网络客户端:语法 URL 防护、按承载 `net.fetch` 的会话线路判定的逐跳 DNS 分类(ADR 0272)、逐跳重定向复核与响应上限——渲染层绝不直接触网。目录 id 会净化为 host `valid_capability_id`。
@@ -1229,7 +1229,7 @@ ASCII slug:frontmatter `name` 能 slugify 时用它,否则 `SKILL.md` 用技
桌面专用 MCP 市场通道(不是 host RPC)走 Electron IPC:
- `pi-desktop/mcp/market/search` — `{ query?, sources[], more? }` →
- `{ entries, failedSources, exhausted }`。Main 校验源 URL,固定每个解析出的公网地址,只跟随有界的 HTTPS 重定向,并为 browse 与服务端搜索保留 cursor 状态。单个源失败不会丢弃成功源;响应和缓存均有界。
+ `{ entries, failedSources, exhausted }`。Main 校验源 URL,并在每一跳向 Electron session 询问线路。完整代理线路使用 session 传输;直连和未知线路默认固定解析出的公网地址,显式 `allowFakeIp` 仅限 benchmark 占位地址。重定向仍是有界 HTTPS,browse 与服务端搜索保留 cursor 状态;单个源失败不会丢弃成功源,响应和缓存均有界。
### MCP OAuth(ADR 0283)
diff --git a/docs/zh-CN/spec/05-security/01-security.md b/docs/zh-CN/spec/05-security/01-security.md
index f8539073e..514ef8c11 100644
--- a/docs/zh-CN/spec/05-security/01-security.md
+++ b/docs/zh-CN/spec/05-security/01-security.md
@@ -96,11 +96,9 @@ CDP 插件工具在 Plan 中仍被拒绝)。 Bash 在 Plan 中仍然可用:
## 4.1 技能市场出网
-渲染层不拉取技能目录或 SKILL.md。Electron 主进程按公网策略发起 HTTPS 请求(ADR 0243 / D413,由 ADR 0272 / D436 修订):仅 `https`、共享的公网主机语法检查、`redirect: "manual"`,以及按请求实际会走的线路逐跳判定。每一跳之前,客户端都会向承载 `net.fetch` 的会话询问它自己的代理判定(`Session.resolveProxy`):`proxied` 线路上按线路判定,而不是按应用永远不会拨打的本地地址判定,因此只容忍解析器自身产物的那一类(`benchmark`,TUN fake-IP);`direct` 或读不出线路时保留完整的本地分类,回环、RFC1918、ULA、link-local、mapped IPv6 以及其他所有非公网类别一律拒绝。安装只通过 `skills.create` 写入 markdown。内联相邻 markdown 后仍受 128 KiB 宿主上限约束。
+渲染层不拉取技能目录或 SKILL.md。Electron 主进程按公网策略发起 HTTPS 请求(ADR 0243 / D413,由 ADR 0272 / D436 修订):仅 `https`、共享的公网主机语法检查、`redirect: "manual"`,以及按请求实际会走的线路逐跳判定。每一跳之前,客户端都会向承载 `net.fetch` 的会话询问它自己的代理判定(`Session.resolveProxy`):`proxied` 线路上按线路判定,因此容忍解析器自身产物的那一类(`benchmark`,TUN fake-IP);`direct` 或读不出线路时默认保留完整的本地分类,回环、RFC1918、ULA、link-local、mapped IPv6 以及其他所有非公网类别一律拒绝。显式 `allowFakeIp` 选项仅可为透明路由器/TUN 部署额外放行 benchmark 占位地址。安装只通过 `skills.create` 写入 markdown。内联相邻 markdown 后仍受 128 KiB 宿主上限约束。
-## 4.2 MCP 市场出网
-
-MCP 市场只接受无凭据的公网 HTTPS 源和目录端点。Main 在每次连接前解析主机名,并把选中的公网地址固定到 HTTPS socket,同时保留原主机名用于 TLS SNI 和 HTTP Host。重定向手动跟随、仅限 HTTPS、最多五跳,并在每次连接前重新检查。响应上限为 4 MiB,请求共享 8 秒截止时间,源、缓存和条目数量均有界。跨 origin 的用户 MCP 重定向不会转发调用方 header。
+MCP 市场只接受无凭据的公网 HTTPS 源和目录端点。Main 在每一跳前向承载请求的同一 Electron session 询问代理线路。在完整的 `proxied` 线路上使用 Chromium `net.fetch`,让系统/PAC 和自定义代理能够解析 fake-IP 主机;此时容忍本地解析器的 `benchmark` fake-IP 类别,但真实私网及其他非公网类别仍然拒绝。在 `direct` 或 `unknown` 线路上保留原有 Node HTTPS 路径,把选中的公网地址固定到 socket,同时保留原主机名用于 TLS SNI 和 HTTP Host;显式 `allowFakeIp` 选项仅额外允许 benchmark 答案,绝不允许其他非公网类别。重定向手动跟随、仅限 HTTPS、最多五跳,并在每次连接前重新检查。响应上限为 4 MiB,请求共享 8 秒截止时间,源、缓存和条目数量均有界。跨 origin 的用户 MCP 重定向不会转发调用方 header。
手动配置的用户 MCP 仍遵循 ADR 0142,可以显式使用本地/LAN 端点;市场路径不会扩大该策略。
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 454f181fa..2b3a9b4f2 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -7902,7 +7902,7 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture
| ID | 场景 | 验证 |
|---|---|---|
-| E2E-MCP-MARKET-NET-BOUNDARY | URL guard 拒绝凭据、回环、私网、special-use IPv4、v4-mapped、ULA、site-local 和 link-local 及尾点绕过形态;Main 固定已检查的公网地址并逐跳复核 HTTPS 重定向 | 确定性 guard 断言;DNS pin 与响应上限 source-contract 覆盖 |
+| E2E-MCP-MARKET-NET-BOUNDARY | URL guard 拒绝凭据、回环、私网、special-use IPv4、v4-mapped、ULA、site-local 和 link-local 及尾点绕过形态;direct/unknown 默认固定已检查的公网地址,完整 proxied 线路使用 session 传输,显式 `allowFakeIp` 可覆盖透明路由器 fake-IP 源但不允许真实私网答案 | 确定性 guard 断言;DNS pin、代理线路选择、fake-IP 选项范围与响应上限 source-contract 覆盖 |
| E2E-MCP-MARKET-SEMANTICS | Registry 记录映射为安装模板时保留包版本、named/positional runtime/package 参数与 required/optional 环境变量语义;远端 header 变量同时识别注册表的 `{name}` 与目录的 `${NAME}` 两种写法,仅为已声明的可编辑值显示输入,保留未声明花括号字面量,并按各 header 的作用域处理默认值、固定值与可选标记,不合并不同 header 的同名输入(ADR registry-header-variable-spelling) | 确定性映射断言 |
| E2E-MCP-MARKET-INSTALL | 内置目录条目经 `resolveCatalogEntry` 解析并通过宿主 `mcp.upsert` RPC 安装;记录落盘 `~/.agents/servers/` | 真实宿主二进制,隔离临时 HOME |
| E2E-MCP-MARKET-HEADER-SCOPE | Registry header-local `{token}` resolves only in its header; same-named URL path/query tokens remain literal through mapping, resolution, host upsert/list and persistence. URL templates retain only legacy `${NAME}` substitution. When `headerBindings` exists (even empty or partial), unbound tokens in every header stay literal and never consume another header's input or default | shared regressions plus real host binary with isolated temporary storage; remote entry disabled, no network call |
diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.md
index 02f584008..ceaff29b5 100644
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@ -4308,10 +4308,9 @@ that amendment are retired by ADR 0268; the upstream work-panel lifecycle stays.
## 2026-09-17 —— 按请求实际会走的线路判定公网地址(D436)
- 技能市场的主进程守卫此前用*本地*解析器判定目标主机,而 `net.fetch` 走的是 Chromium 的代理栈(ADR 0177)。在 TUN / fake-IP 解析器下,那个答案是应用永远不会建立的连接的合成地址(`198.18.0.0/15`),于是每个目录源都被判为「被应用的地址校验阻止」(issue #419)。
-- 现在每一跳都向承载 `net.fetch` 的会话询问它自己的判定(`Session.resolveProxy`),共享的 `classifyProxyRoute` 把该答案归为 `proxied` / `direct` / `unknown`。在 `proxied` 线路上,`isAcceptableResolvedAddress` 只容忍解析器自身产物的那一类(`benchmark`);所有真实内网类别与「解析器没有应答」仍然拒绝。`direct` 线路与改动前逐字一致;列表里任何位置出现 `DIRECT` 都按 `unknown` 处理(Chromium 可能回退到它),而 `unknown` 走严格路径。
+- 现在每一跳都向承载 `net.fetch` 的会话询问它自己的判定(`Session.resolveProxy`),共享的 `classifyProxyRoute` 把该答案归为 `proxied` / `direct` / `unknown`。在 `proxied` 线路上,`isAcceptableResolvedAddress` 只容忍解析器自身产物的那一类(`benchmark`);所有真实内网类别与「解析器没有应答」仍然拒绝。`direct` 线路默认与改动前逐字一致,但显式 `allowFakeIp` 仅可额外放行 benchmark 占位地址;列表里任何位置出现 `DIRECT` 都按 `unknown` 处理(Chromium 可能回退到它),而 `unknown` 走严格路径。
- 拒绝与市场的 `failureDetails` 现在都带 `route`,因此「直连线路上的 fake-IP 拒绝」与「读不出线路的拒绝」在诊断里可以区分。
-- MCP 市场仍使用自己的地址钉定 Node HTTPS 守卫(ADR 0245),本次不变;fake-IP 环境下它的源仍会被拒绝。
-- 见 ADR 0272、`05-security/01-security.md` §4.1、`03-runtime/09-logging-and-observability.md` 与 `06-delivery/04-e2e-test-plan.md` 的 E2E-SKILL-MARKET-NET-BOUNDARY。
+- MCP 市场现在也在每一跳向 Electron session 询问线路:完整代理线路使用 `net.fetch`,让 fake-IP 源能够到达已配置的代理;直连和未知线路默认继续使用固定 Node HTTPS 地址的严格公网规则。显式 `allowFakeIp` 选项仅为透明路由器/TUN 部署放行 benchmark 占位地址,真实私网答案在所有线路上仍然拒绝。见 ADR 0245。
## 2026-09-17 —— dock 内的问题卡是 composer 板(#360,D437)
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 4c4fba2d2..820568390 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -1004,6 +1004,8 @@ sklm: {
"proxyUrlPlaceholder": "sock5://127.0.0.1:1080",
"proxyBypass": "Bypass",
"proxyBypassDesc": "Hosts, die den Proxy überspringen.",
+ proxyFakeIp: "Proxy-Fake-IP für Marktquellen zulassen",
+ proxyFakeIpDesc: "Nur für einen transparenten Router-/TUN-Proxy aktivieren. Andere private Adressen bleiben blockiert.",
"proxyInvalid": "Geben Sie eine http-, https- oder sock5-URL mit einem Host ein.",
"proxySaveError": "Der Proxy konnte nicht gespeichert werden.",
"proxyTest": "Test",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index e3b69ebcc..ff75e5988 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -1016,6 +1016,8 @@ sklm: {
proxyUrlPlaceholder: "socks5://127.0.0.1:1080",
proxyBypass: "Bypass",
proxyBypassDesc: "Hosts that skip the proxy.",
+ proxyFakeIp: "Allow proxy fake-IP for market sources",
+ proxyFakeIpDesc: "Only enable this for a transparent router/TUN proxy. Other private addresses remain blocked.",
proxyInvalid: "Enter an http, https, or socks5 URL with a host.",
proxySaveError: "Couldn't save the proxy.",
proxyTest: "Test",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 667a54c07..47eff7517 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -1004,6 +1004,8 @@ sklm: {
"proxyUrlPlaceholder": "calcetines5://127.0.0.1:1080",
"proxyBypass": "Omitir",
"proxyBypassDesc": "Hosts que omiten el proxy.",
+ proxyFakeIp: "Permitir fake-IP del proxy para fuentes del mercado",
+ proxyFakeIpDesc: "Actívalo solo con un proxy transparente de router/TUN. Las demás direcciones privadas siguen bloqueadas.",
"proxyInvalid": "Ingrese una URL http, https o Socks5 con un host.",
"proxySaveError": "No se pudo guardar el proxy.",
"proxyTest": "Prueba",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index d69c1f39a..918973387 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -1004,6 +1004,8 @@ sklm: {
"proxyUrlPlaceholder": "chaussettes5://127.0.0.1:1080",
"proxyBypass": "Contourner",
"proxyBypassDesc": "Hôtes qui ignorent le proxy.",
+ proxyFakeIp: "Autoriser les fake-IP du proxy pour les sources du marché",
+ proxyFakeIpDesc: "À activer uniquement avec un proxy transparent de routeur/TUN. Les autres adresses privées restent bloquées.",
"proxyInvalid": "Saisissez une URL http, https ou chaussettes5 avec un hôte.",
"proxySaveError": "Impossible d'enregistrer le proxy.",
"proxyTest": "Test",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index 9c9cb78c7..dfc684138 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -1017,6 +1017,8 @@ sklm: {
proxyUrlPlaceholder: "socks5://127.0.0.1:1080",
proxyBypass: "우회",
proxyBypassDesc: "프록시를 사용하지 않을 호스트입니다.",
+ proxyFakeIp: "마켓 소스에 프록시 fake-IP 허용",
+ proxyFakeIpDesc: "투명한 라우터/TUN 프록시에서만 켜세요. 다른 사설 주소는 계속 차단됩니다.",
proxyInvalid: "호스트가 포함된 http, https 또는 socks5 URL을 입력하세요.",
proxySaveError: "프록시를 저장할 수 없습니다.",
proxyTest: "테스트",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index a3e57db14..c5ee03c3e 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -1017,6 +1017,8 @@ sklm: {
proxyUrlPlaceholder: "socks5://127.0.0.1:1080",
proxyBypass: "Muaf tut",
proxyBypassDesc: "Vekili atlayan ana makineler.",
+ proxyFakeIp: "Pazar kaynakları için proxy fake-IP adreslerine izin ver",
+ proxyFakeIpDesc: "Yalnızca şeffaf yönlendirici/TUN proxy için açın. Diğer özel adresler engellenmeye devam eder.",
proxyInvalid: "Ana makineli bir http, https veya socks5 URL’si girin.",
proxySaveError: "Vekil kaydedilemedi.",
proxyTest: "Dene",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 6e6020c2d..9dc2e6422 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -1004,6 +1004,8 @@ sklm: {
proxyUrlPlaceholder: "socks5://127.0.0.1:1080",
proxyBypass: "绕过列表",
proxyBypassDesc: "不走代理的主机。",
+ proxyFakeIp: "允许市场源使用代理 fake-IP",
+ proxyFakeIpDesc: "仅在路由器/TUN 透明代理下开启;其他私网地址仍会被阻止。",
proxyInvalid: "请输入带主机名的 http、https 或 socks5 URL。",
proxySaveError: "无法保存代理设置。",
proxyTest: "测试",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 6bd827035..eb5ff289f 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -1004,6 +1004,8 @@ sklm: {
proxyUrlPlaceholder: "socks5://127.0.0.1:1080",
proxyBypass: "繞過列表",
proxyBypassDesc: "不走代理的主機。",
+ proxyFakeIp: "允許市場來源使用代理 fake-IP",
+ proxyFakeIpDesc: "僅在路由器/TUN 透明代理下開啟;其他私有位址仍會被阻止。",
proxyInvalid: "請輸入帶主機名的 http、https 或 socks5 URL。",
proxySaveError: "無法儲存代理設定。",
proxyTest: "測試",
diff --git a/packages/shared/src/network-proxy.test.ts b/packages/shared/src/network-proxy.test.ts
index 86b130c0a..49e907666 100644
--- a/packages/shared/src/network-proxy.test.ts
+++ b/packages/shared/src/network-proxy.test.ts
@@ -76,6 +76,16 @@ describe("validateNetworkProxy", () => {
value: { mode: "direct" },
});
});
+ it("preserves the explicit fake-IP market opt-in without widening other modes", () => {
+ expect(validateNetworkProxy({ mode: "direct", allowFakeIp: true })).toEqual({
+ ok: true,
+ value: { mode: "direct", allowFakeIp: true },
+ });
+ expect(validateNetworkProxy({ mode: "system", allowFakeIp: false })).toEqual({
+ ok: true,
+ value: { mode: "system" },
+ });
+ });
it("requires a valid URL in custom mode", () => {
expect(validateNetworkProxy({ mode: "custom" }).ok).toBe(false);
diff --git a/packages/shared/src/network-proxy.ts b/packages/shared/src/network-proxy.ts
index 000d3aa8e..763640a90 100644
--- a/packages/shared/src/network-proxy.ts
+++ b/packages/shared/src/network-proxy.ts
@@ -42,6 +42,12 @@ export type NetworkProxySettings = {
* {@link DEFAULT_NETWORK_PROXY_BYPASS} for custom mode.
*/
bypass?: string;
+ /**
+ * Opt in to router/TUN fake-IP answers for public market sources. This only
+ * permits the benchmark placeholder range; all other non-public classes stay
+ * blocked. Absent means disabled.
+ */
+ allowFakeIp?: boolean;
};
export type ParsedProxyUrl = {
@@ -81,6 +87,7 @@ export function normalizeNetworkProxy(value: unknown): NetworkProxySettings {
settings.url = record.url.trim();
}
if (bypass) settings.bypass = bypass;
+ if (record?.allowFakeIp === true) settings.allowFakeIp = true;
return settings;
}
@@ -189,7 +196,9 @@ export function validateNetworkProxy(
): { ok: true; value: NetworkProxySettings } | { ok: false; error: string } {
const settings = normalizeNetworkProxy(value);
if (settings.mode !== "custom") {
- return { ok: true, value: { mode: settings.mode } };
+ const next: NetworkProxySettings = { mode: settings.mode };
+ if (settings.allowFakeIp) next.allowFakeIp = true;
+ return { ok: true, value: next };
}
const parsed = parseProxyUrl(settings.url ?? "");
if (!parsed.ok) return parsed;
@@ -198,6 +207,7 @@ export function validateNetworkProxy(
url: parsed.value.href,
};
if (settings.bypass?.trim()) next.bypass = settings.bypass.trim();
+ if (settings.allowFakeIp) next.allowFakeIp = true;
return { ok: true, value: next };
}