Skip to content

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

fix(skill-market): give a proxy fake-IP its own cause instead of a policy refusal

vastsaf7e4d4d467a6
diff --git a/apps/desktop/electron/main/ipc/skills-ipc.ts b/apps/desktop/electron/main/ipc/skills-ipc.ts
index 4a09adbdf..ee9656741 100644
--- a/apps/desktop/electron/main/ipc/skills-ipc.ts
+++ b/apps/desktop/electron/main/ipc/skills-ipc.ts
@@ -64,7 +64,10 @@ export function registerSkillsIpc({
* carries no code, as before.
*/
const refusalCode = (kind: SkillMarketFailureKind): string | undefined => {
- if (kind === "policy") return ErrorCodes.NETWORK_POLICY_BLOCKED;
+ // Both are refusals the guard decided, so both carry the policy code; the
+ // `kind` beside it is what says which address was judged — the proxy's own
+ // fake-IP placeholder, or the target's actual address.
+ if (kind === "policy" || kind === "fake-ip") return ErrorCodes.NETWORK_POLICY_BLOCKED;
if (kind === "unresolved") return ErrorCodes.NETWORK_RESOLVE_FAILED;
return undefined;
};
@@ -78,6 +81,7 @@ export function registerSkillsIpc({
...(detail.host ? { host: detail.host } : {}),
kind: detail.kind,
...(detail.reason ? { reason: detail.reason } : {}),
+ ...(detail.address ? { address: detail.address } : {}),
...(detail.addressKind ? { addressKind: detail.addressKind } : {}),
},
});
@@ -91,7 +95,9 @@ export function registerSkillsIpc({
const detail = result.failureDetails?.[name];
if (detail) return detail;
const kind = result.failureKinds?.[name];
- return { kind: kind === "policy" || kind === "unresolved" ? kind : "network" };
+ return {
+ kind: kind === "policy" || kind === "fake-ip" || kind === "unresolved" ? kind : "network",
+ };
};
let host: HostProcess | null = null;
const handle = (channel: string, fn: (...args: any[]) => Promise<any>) => {
diff --git a/apps/desktop/electron/main/public-https-fetch.ts b/apps/desktop/electron/main/public-https-fetch.ts
index f23bb2e1f..5521847c2 100644
--- a/apps/desktop/electron/main/public-https-fetch.ts
+++ b/apps/desktop/electron/main/public-https-fetch.ts
@@ -7,6 +7,7 @@ import {
isSafePublicHttpsUrl,
publicNetworkRefusalReason,
type PublicNetworkAddressKind,
+ type PublicNetworkRefusalDetail,
type PublicNetworkRefusalReason,
} from "@pi-desktop/shared";
@@ -56,6 +57,15 @@ export class PublicNetworkPolicyError extends Error {
readonly address?: string;
/** The class of `address`, not just the address: it names the cause. */
readonly addressKind?: PublicNetworkAddressKind;
+ /**
+ * The same finding, shaped for the IPC boundary: `wrap()` forwards this object
+ * as the renderer's `error.details` (`register.ts`), which is how the panel
+ * tells a TUN fake-IP apart from a real private target without parsing an
+ * English message. Both arrive under one code — both are refusals the guard
+ * decided — so the structured reason is the only honest way to separate them
+ * (issue #419).
+ */
+ readonly data: PublicNetworkRefusalDetail;
constructor(message: string, refusal: PublicNetworkRefusal = { reason: "non-public-address" }) {
super(message);
this.name = PUBLIC_NETWORK_POLICY_ERROR;
@@ -67,6 +77,12 @@ export class PublicNetworkPolicyError extends Error {
refusal.reason === "resolve-failed"
? ErrorCodes.NETWORK_RESOLVE_FAILED
: ErrorCodes.NETWORK_POLICY_BLOCKED;
+ this.data = {
+ reason: refusal.reason,
+ ...(refusal.host ? { host: refusal.host } : {}),
+ ...(refusal.address ? { address: refusal.address } : {}),
+ ...(refusal.addressKind ? { addressKind: refusal.addressKind } : {}),
+ };
}
}
diff --git a/apps/desktop/electron/main/skill-market-scan.ts b/apps/desktop/electron/main/skill-market-scan.ts
index 35e6e9996..8a29fa0e7 100644
--- a/apps/desktop/electron/main/skill-market-scan.ts
+++ b/apps/desktop/electron/main/skill-market-scan.ts
@@ -6,6 +6,7 @@
*/
import {
PUBLIC_NETWORK_POLICY_ERROR,
+ isProxyFakeIpAddress,
isSafeSkillSourceUrl,
publicNetworkRefusalDetail,
sanitizeSkillCatalogId,
@@ -23,12 +24,15 @@ export type CatalogRequest = (url: string, kind: "json" | "text") => Promise<unk
/**
* Why a source failed. `policy` means the guard judged an address (or the URL
- * itself) and refused it. `unresolved` means the local resolver produced no
- * answer at all, so nothing was judged — an environment condition that a proxy
- * or a working resolver fixes, and that must never be reported as an
- * address-check block (issue #419). `network` is everything else.
+ * itself) and refused it, and the address is the target's own. `fake-ip` is a
+ * refusal of an address the *local proxy* invented for the name — Clash's
+ * `198.18.0.0/15`, refused exactly as any other non-public address, but a
+ * condition of the local network rather than a fact about the source.
+ * `unresolved` means the local resolver produced no answer at all, so nothing
+ * was judged — also an environment condition, and likewise never an
+ * address-check block. `network` is everything else (issue #419).
*/
-export type SkillMarketFailureKind = "policy" | "unresolved" | "network";
+export type SkillMarketFailureKind = "policy" | "fake-ip" | "unresolved" | "network";
/** Everything the panel and the log may say about one failed source. */
export type SkillMarketFailureDetail = {
@@ -42,10 +46,18 @@ export type SkillMarketFailureDetail = {
/** The guard's structured reason, when a guard refusal produced this. */
reason?: PublicNetworkRefusalReason;
/**
- * The class of the address that failed a policy check — `benchmark` for a TUN
- * fake-IP, `private` for RFC1918, `loopback` for a redirect to localhost. The
- * class is what tells a resolver artifact apart from a real private target.
- * The address itself is deliberately not carried.
+ * The address the guard resolved `host` to, when a policy check judged one.
+ * This is the local resolver's answer — not user input, not a URL component —
+ * and it is the most diagnostic field a refusal has: `198.18.0.1` reads as a
+ * proxy in fake-IP mode at a glance, which is exactly the case issue #419 is
+ * about. Only a well-formed IP literal is carried (see
+ * `publicNetworkRefusalDetail`).
+ */
+ address?: string;
+ /**
+ * The class of that address — `benchmark` for a TUN fake-IP, `private` for
+ * RFC1918, `loopback` for a redirect to localhost. The class is what a caller
+ * decides on; the address is what the user recognises.
*/
addressKind?: PublicNetworkAddressKind;
};
@@ -91,7 +103,14 @@ export function classifySkillMarketFailure(error: unknown): SkillMarketFailureKi
// cannot name its reason is still a refusal, so it stays `policy`.
const refusal = publicNetworkRefusalDetail(error);
if (!refusal) return "network";
- return refusal.reason === "resolve-failed" ? "unresolved" : "policy";
+ if (refusal.reason === "resolve-failed") return "unresolved";
+ // A fake-IP answer is refused like any other non-public address, but the
+ // address is the *proxy's* placeholder for the name rather than the target's
+ // own, so it gets its own cause and its own advice (issue #419).
+ if (refusal.reason === "non-public-address" && isProxyFakeIpAddress(refusal.addressKind)) {
+ return "fake-ip";
+ }
+ return "policy";
}
/**
@@ -131,6 +150,7 @@ export function skillMarketFailureDetail(
...(host ? { host } : {}),
kind: classifySkillMarketFailure(error),
...(refusal ? { reason: refusal.reason } : {}),
+ ...(refusal?.address ? { address: refusal.address } : {}),
...(refusal?.addressKind ? { addressKind: refusal.addressKind } : {}),
};
}
@@ -139,7 +159,8 @@ export function skillMarketFailureDetail(
const FAILURE_RANK: Record<SkillMarketFailureKind, number> = {
network: 0,
unresolved: 1,
- policy: 2,
+ "fake-ip": 2,
+ policy: 3,
};
const SKILL_CATEGORY_KEYWORDS: ReadonlyArray<readonly [SkillCatalogCategory, string[]]> = [
@@ -310,6 +331,7 @@ export function createSkillMarketAggregator(request: CatalogRequest) {
kind: classifySkillMarketFailure(result.reason),
...(host ? { host } : {}),
...(refusal ? { reason: refusal.reason } : {}),
+ ...(refusal?.address ? { address: refusal.address } : {}),
...(refusal?.addressKind ? { addressKind: refusal.addressKind } : {}),
});
return;
diff --git a/apps/desktop/src/components/settings/SkillMarketPanel.tsx b/apps/desktop/src/components/settings/SkillMarketPanel.tsx
index bc84e9bd9..41b80f5ab 100644
--- a/apps/desktop/src/components/settings/SkillMarketPanel.tsx
+++ b/apps/desktop/src/components/settings/SkillMarketPanel.tsx
@@ -29,6 +29,7 @@ import { Field, Input, TooltipButton, cx } from "../ui";
import { LatestWinsGate } from "../../lib/latest-wins";
import {
classifySkillMarketFailure,
+ hasFakeIpFailure,
hasPolicyFailure,
hasUnresolvedFailure,
skillMarketFailureDetail,
@@ -71,7 +72,12 @@ type MarketItem = SkillCatalogEntry & { sourceId?: string };
* only the source label — a policy refusal is a statement about one address
* (issue #419). The address itself is never sent.
*/
-type RemoteFailureDetail = { host?: string; reason?: string; addressKind?: string };
+type RemoteFailureDetail = {
+ host?: string;
+ address?: string;
+ reason?: string;
+ addressKind?: string;
+};
type RemoteState = {
status: "idle" | "loading" | "ready" | "error";
@@ -342,11 +348,13 @@ export function SkillMarketPanel({
// A bare `remoteError` could not tell a policy refusal from a dead host, and
// one `policy` bucket could not tell an address the guard *judged* from a
- // resolver that never answered at all. The three now carry different copy,
+ // resolver that never answered — nor the target's own address from the fake-IP
+ // placeholder a local proxy invents for it. The four now carry different copy,
// and each failure names the host it is about.
const remoteErrorText = () => {
if (remote.queryError) return t("settings.sklm.remoteErrorQuery");
if (hasPolicyFailure(remote.failureKinds)) return t("settings.sklm.remoteErrorPolicy");
+ if (hasFakeIpFailure(remote.failureKinds)) return t("settings.sklm.remoteErrorFakeIp");
if (hasUnresolvedFailure(remote.failureKinds)) return t("settings.sklm.remoteErrorUnresolved");
return t("settings.sklm.remoteError");
};
@@ -362,6 +370,20 @@ export function SkillMarketPanel({
return host ? t("settings.sklm.failureSourceHost", { name, host }) : name;
});
+ /**
+ * A refusal on a proxy-invented address is the one case where the fix is a
+ * setting rather than a source. Naming both the host and the address turns
+ * "the app blocked it" into "your proxy answered 198.18.0.1 for github.com",
+ * which is what lets a user recognise fake-IP mode (issue #419). Falls back to
+ * the plain sentence when the guard reported no address to show.
+ */
+ const fakeIpFailureText = () => {
+ const name = remote.failed.find((entry) => remote.failureKinds[entry] === "fake-ip");
+ const detail = name ? remote.failureDetails[name] : undefined;
+ if (!detail?.host || !detail.address) return t("settings.sklm.fakeIpHintPlain");
+ return t("settings.sklm.fakeIpHint", { host: detail.host, address: detail.address });
+ };
+
const sourcesSheet = sourcesOpen ? (
<div
className="overlay ext-sheet-overlay sklm-overlay"
@@ -513,9 +535,11 @@ export function SkillMarketPanel({
{t(
previewFailure.kind === "policy"
? "settings.sklm.previewPolicyError"
- : previewFailure.kind === "unresolved"
- ? "settings.sklm.previewResolveError"
- : "settings.sklm.previewError",
+ : previewFailure.kind === "fake-ip"
+ ? "settings.sklm.previewFakeIpError"
+ : previewFailure.kind === "unresolved"
+ ? "settings.sklm.previewResolveError"
+ : "settings.sklm.previewError",
)}
</p>
) : (
@@ -524,6 +548,9 @@ export function SkillMarketPanel({
{previewFailure?.kind === "policy" ? (
<p className="sklm-note">{t("settings.sklm.proxyHint")}</p>
) : null}
+ {previewFailure?.kind === "fake-ip" ? (
+ <p className="sklm-note">{t("settings.sklm.fakeIpHintPlain")}</p>
+ ) : null}
{previewFailure?.kind === "unresolved" ? (
<p className="sklm-note">{t("settings.sklm.dnsHint")}</p>
) : null}
@@ -632,6 +659,9 @@ export function SkillMarketPanel({
{hasPolicyFailure(remote.failureKinds) ? (
<p className="sklm-status">{t("settings.sklm.proxyHint")}</p>
) : null}
+ {hasFakeIpFailure(remote.failureKinds) ? (
+ <p className="sklm-status">{fakeIpFailureText()}</p>
+ ) : null}
{hasUnresolvedFailure(remote.failureKinds) ? (
<p className="sklm-status">{t("settings.sklm.dnsHint")}</p>
) : null}
@@ -645,6 +675,9 @@ export function SkillMarketPanel({
{hasPolicyFailure(remote.failureKinds) ? (
<p className="sklm-status">{t("settings.sklm.proxyHint")}</p>
) : null}
+ {hasFakeIpFailure(remote.failureKinds) ? (
+ <p className="sklm-status">{fakeIpFailureText()}</p>
+ ) : null}
{hasUnresolvedFailure(remote.failureKinds) ? (
<p className="sklm-status">{t("settings.sklm.dnsHint")}</p>
) : null}
diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.ts
index 6f09b3c3f..52fcc6a3d 100644
--- a/apps/desktop/src/lib/api.ts
+++ b/apps/desktop/src/lib/api.ts
@@ -734,13 +734,22 @@ export const api = {
* Why each named source failed, so the market can explain a policy/DNS
* refusal instead of reporting every source as merely unreachable.
*/
- failureKinds?: Record<string, "policy" | "unresolved" | "network">;
+ failureKinds?: Record<string, "policy" | "fake-ip" | "unresolved" | "network">;
/**
* The host and the guard's own reason behind each failed source. Without
* it the panel can say a source was refused but not *what* was refused,
* and a policy refusal is a statement about one address (issue #419).
*/
- failureDetails?: Record<string, { host?: string; reason?: string; addressKind?: string }>;
+ /**
+ * The host, the address it resolved to, and the guard's own reason behind
+ * each failed source. Without them the panel can say a source was refused
+ * but not *what* was refused — and `198.18.0.1` is what tells a user their
+ * proxy is in fake-IP mode (issue #419).
+ */
+ failureDetails?: Record<
+ string,
+ { host?: string; address?: string; reason?: string; addressKind?: string }
+ >;
}>(IPC.invoke.skillMarketSearch, { query, sources }),
/** Fetch one catalog document (frontmatter split off) for preview/install. */
fetchSkillMarketDocument: (entry: SkillCatalogEntry) =>
diff --git a/apps/desktop/src/lib/skill-market-failure.ts b/apps/desktop/src/lib/skill-market-failure.ts
index a887a2850..63a461662 100644
--- a/apps/desktop/src/lib/skill-market-failure.ts
+++ b/apps/desktop/src/lib/skill-market-failure.ts
@@ -1,26 +1,42 @@
-import { ErrorCodes } from "@pi-desktop/shared";
+import { ErrorCodes, isProxyFakeIpAddress, type PublicNetworkAddressKind } from "@pi-desktop/shared";
/**
* Why a skill market request failed, as far as the renderer can tell.
*
* `policy` means the main process refused the fetch inside its public-network
- * guard, and that refusal judged an address (or the URL itself): a verdict that
- * the destination is not a public host.
+ * guard because it judged an address, and that address was the target's own.
*
- * `unresolved` means the guard reached no verdict at all — the local DNS lookup
- * returned no answer. The guard classifies the host with a *local* resolver,
- * while the request itself would have gone through the configured proxy
- * (ADR 0177, ADR 0243). A user behind a proxy or TUN resolver that answers DNS
- * itself — Clash fake-IP in `198.18.0.0/15`, a corporate split resolver, an
- * offline resolver — can hit either case, and the two need different advice:
- * one is about the destination, the other about the resolver. Keeping them
- * apart is the whole point of surfacing this instead of one generic failure
- * (issue #419).
+ * `fake-ip` is that same refusal applied to an address the *local proxy* invented
+ * for the name — Clash, Mihomo, sing-box and Surge all ship `198.18.0.0/15` as
+ * their default fake-IP pool. It is refused exactly as any other non-public
+ * address, so it is not a weaker finding; it is a different one, and only advice
+ * about the proxy mode helps. The guard classifies the host with a *local*
+ * resolver while the request itself would go through that proxy (ADR 0177,
+ * ADR 0243), so this case says nothing about the source.
+ *
+ * `unresolved` means the guard reached no verdict at all: the local DNS lookup
+ * returned no answer.
+ *
+ * Keeping these apart is the whole point of surfacing them instead of one
+ * generic failure (issue #419).
*/
-export type SkillMarketFailureKind = "policy" | "unresolved" | "network";
+export type SkillMarketFailureKind = "policy" | "fake-ip" | "unresolved" | "network";
/** Classify a rejected `api.fetchSkillMarketDocument` / search call. */
export function classifySkillMarketFailure(error: unknown): SkillMarketFailureKind {
+ // `wrap()` forwards the guard's own `data` as this error's `details`, so the
+ // structured reason survives the IPC boundary. A judged fake-IP and a judged
+ // private target arrive under one code — both are refusals the guard decided —
+ // which makes the author's address class the only honest way to separate them.
+ const details = (
+ error as { details?: { reason?: unknown; addressKind?: unknown } } | null | undefined
+ )?.details;
+ if (
+ details?.reason === "non-public-address" &&
+ isProxyFakeIpAddress(details.addressKind as PublicNetworkAddressKind | undefined)
+ ) {
+ return "fake-ip";
+ }
const code = (error as { code?: unknown } | null | undefined)?.code;
if (code === ErrorCodes.NETWORK_POLICY_BLOCKED) return "policy";
if (code === ErrorCodes.NETWORK_RESOLVE_FAILED) return "unresolved";
@@ -29,9 +45,10 @@ export function classifySkillMarketFailure(error: unknown): SkillMarketFailureKi
/**
* The main-process reason, kept verbatim for the install sheet. It is internal
- * English text, but it names the failing host only — the URL shown next to it
- * in the sheet is already the same public HTTPS address, and the guard rejects
- * credential-bearing URLs, so this adds no secret to the screen.
+ * English text, but it names the failing host and the address it resolved to
+ * only — the URL shown next to it in the sheet is already the same public HTTPS
+ * address, and the guard rejects credential-bearing URLs, so this adds no secret
+ * to the screen.
*/
export function skillMarketFailureDetail(error: unknown): string {
if (error instanceof Error && error.message) return error.message;
@@ -40,18 +57,26 @@ export function skillMarketFailureDetail(error: unknown): string {
}
/**
- * Whether a list of failed sources contains at least one policy refusal — a
- * verdict on an address — which is what makes the address-check explanation and
- * its resolver hint worth showing.
+ * Whether a list of failed sources contains at least one refusal of the target's
+ * own address — the strongest finding, because it is about the destination
+ * rather than about the machine's resolver or proxy mode.
*/
export function hasPolicyFailure(kinds: Record<string, unknown> | undefined): boolean {
return Object.values(kinds ?? {}).includes("policy");
}
/**
- * Whether any source failed because the local resolver had no answer. Always
- * checked *after* `hasPolicyFailure`: when both are present the panel leads with
- * the stronger, address-level refusal.
+ * Whether any source was refused on an address the local proxy invented. Checked
+ * after `hasPolicyFailure`: when both are present the panel leads with the
+ * destination-level finding, which is the more serious of the two.
+ */
+export function hasFakeIpFailure(kinds: Record<string, unknown> | undefined): boolean {
+ return Object.values(kinds ?? {}).includes("fake-ip");
+}
+
+/**
+ * Whether any source failed because the local resolver had no answer. Checked
+ * last: it is the least specific of the three causes.
*/
export function hasUnresolvedFailure(kinds: Record<string, unknown> | undefined): boolean {
return Object.values(kinds ?? {}).includes("unresolved");
diff --git a/apps/desktop/test/skill-market-failure.test.mjs b/apps/desktop/test/skill-market-failure.test.mjs
index 89f670de9..bc04498bd 100644
--- a/apps/desktop/test/skill-market-failure.test.mjs
+++ b/apps/desktop/test/skill-market-failure.test.mjs
@@ -3,6 +3,7 @@ import test from "node:test";
import { ErrorCodes } from "@pi-desktop/shared";
import {
classifySkillMarketFailure,
+ hasFakeIpFailure,
hasPolicyFailure,
hasUnresolvedFailure,
skillMarketFailureDetail,
@@ -12,16 +13,50 @@ import {
* Regression cover for issue #419: behind a proxy the main process can refuse a
* skill market fetch inside its local-DNS public-network guard, and the install
* sheet used to swallow that rejection and leave the install button disabled
- * with no reason. The renderer can only tell the cases apart by the stable error
- * code the IPC wrapper forwards, so that mapping is what gets pinned here.
+ * with no reason. The renderer can only tell the cases apart by what the IPC
+ * wrapper forwards, so that mapping is what gets pinned here.
*
- * Two refusals, not one: an address the guard *judged* is a policy decision,
- * while a resolver that answered nothing never reached a verdict. Reporting the
- * second as the first is what told a proxied user their sources were "blocked by
- * the app's address check" when no address had been classified.
+ * Four causes, not one. An address the guard judged and the target's own is a
+ * policy decision; the same refusal applied to an address the *local proxy*
+ * invented (Clash's `198.18.0.0/15` fake-IP pool) is a different finding with
+ * different advice; a resolver that answered nothing reached no verdict; and
+ * everything else is a transport failure. Reporting the middle two as the first
+ * is what told a proxied user their sources were "blocked by the app's address
+ * check".
*/
-test("a judged address, an unanswered resolver and a dead host are three cases", () => {
+test("a judged fake-IP, a judged private target, an unanswered resolver and a dead host are four cases", () => {
+ // The guard's own `data` reaches the renderer as `error.details` (register.ts
+ // `wrap()`), which is the only thing that separates these two: both arrive
+ // under NETWORK_POLICY_BLOCKED, because both are refusals the guard decided.
+ const fakeIp = Object.assign(
+ new Error("hostname resolves to a non-public address: api.github.com -> 198.18.0.1 (benchmark)"),
+ {
+ code: ErrorCodes.NETWORK_POLICY_BLOCKED,
+ details: {
+ reason: "non-public-address",
+ host: "api.github.com",
+ address: "198.18.0.1",
+ addressKind: "benchmark",
+ },
+ },
+ );
+ assert.equal(classifySkillMarketFailure(fakeIp), "fake-ip");
+
+ const privateTarget = Object.assign(
+ new Error("hostname resolves to a non-public address: api.github.com -> 10.1.2.3 (private)"),
+ {
+ code: ErrorCodes.NETWORK_POLICY_BLOCKED,
+ details: {
+ reason: "non-public-address",
+ host: "api.github.com",
+ address: "10.1.2.3",
+ addressKind: "private",
+ },
+ },
+ );
+ assert.equal(classifySkillMarketFailure(privateTarget), "policy");
+
const judged = Object.assign(
new Error("hostname resolves to a non-public address: api.github.com -> 198.18.0.4 (benchmark)"),
{ code: ErrorCodes.NETWORK_POLICY_BLOCKED },
@@ -30,6 +65,7 @@ test("a judged address, an unanswered resolver and a dead host are three cases",
const unresolved = Object.assign(new Error("hostname does not resolve: api.github.com (ENOTFOUND)"), {
code: ErrorCodes.NETWORK_RESOLVE_FAILED,
+ details: { reason: "resolve-failed", host: "api.github.com" },
});
assert.equal(classifySkillMarketFailure(unresolved), "unresolved");
@@ -46,6 +82,22 @@ test("a judged address, an unanswered resolver and a dead host are three cases",
}
});
+test("a refusal whose details did not survive the boundary stays a refusal", () => {
+ // `details` is an optimisation for the explanation, never a precondition for
+ // blocking. A refusal that arrives without it must not degrade to "network",
+ // which would tell the user the source is unreachable.
+ const bare = Object.assign(new Error("hostname resolves to a non-public address"), {
+ code: ErrorCodes.NETWORK_POLICY_BLOCKED,
+ });
+ assert.equal(classifySkillMarketFailure(bare), "policy");
+ // An unrecognized class must not be read as fake-IP either.
+ const unknownClass = Object.assign(new Error("hostname resolves to a non-public address"), {
+ code: ErrorCodes.NETWORK_POLICY_BLOCKED,
+ details: { reason: "non-public-address", addressKind: "made-up" },
+ });
+ assert.equal(classifySkillMarketFailure(unknownClass), "policy");
+});
+
test("the sheet keeps the main-process reason and never invents one", () => {
const unresolved = Object.assign(new Error("hostname does not resolve: api.github.com"), {
code: ErrorCodes.NETWORK_RESOLVE_FAILED,
@@ -56,17 +108,26 @@ test("the sheet keeps the main-process reason and never invents one", () => {
assert.equal(skillMarketFailureDetail({}), "");
});
-test("the two hints are chosen by cause, not by failure count", () => {
- // An address-level refusal is the stronger statement and leads; a resolver
- // that answered nothing gets the resolver hint instead. Neither may claim the
- // other's cause.
+test("the three hints are chosen by cause, not by failure count", () => {
+ // A refusal of the target's own address is the strongest statement and leads;
+ // a proxy fake-IP gets the proxy-mode hint; a resolver that answered nothing
+ // gets the resolver hint. None may claim another's cause.
assert.equal(hasPolicyFailure({ "anthropics/skills": "policy" }), true);
+ assert.equal(hasPolicyFailure({ "anthropics/skills": "fake-ip" }), false);
assert.equal(hasPolicyFailure({ "anthropics/skills": "unresolved" }), false);
assert.equal(hasPolicyFailure({ "anthropics/skills": "network" }), false);
assert.equal(hasPolicyFailure({}), false);
assert.equal(hasPolicyFailure(undefined), false);
+ assert.equal(hasFakeIpFailure({ "anthropics/skills": "fake-ip" }), true);
+ assert.equal(hasFakeIpFailure({ "anthropics/skills": "policy" }), false);
+ assert.equal(hasFakeIpFailure({ "anthropics/skills": "unresolved" }), false);
+ assert.equal(hasFakeIpFailure({ "anthropics/skills": "network" }), false);
+ assert.equal(hasFakeIpFailure({}), false);
+ assert.equal(hasFakeIpFailure(undefined), false);
+
assert.equal(hasUnresolvedFailure({ "anthropics/skills": "unresolved" }), true);
+ assert.equal(hasUnresolvedFailure({ "anthropics/skills": "fake-ip" }), false);
assert.equal(hasUnresolvedFailure({ "anthropics/skills": "policy" }), false);
assert.equal(hasUnresolvedFailure({ "anthropics/skills": "network" }), false);
assert.equal(hasUnresolvedFailure({}), false);
diff --git a/apps/desktop/test/skill-market-panel.test.mjs b/apps/desktop/test/skill-market-panel.test.mjs
index 6178b0148..81b525730 100644
--- a/apps/desktop/test/skill-market-panel.test.mjs
+++ b/apps/desktop/test/skill-market-panel.test.mjs
@@ -128,6 +128,31 @@ test("a resolver with no answer is explained as that, not as an address check",
assert.match(panel, /failureDetails: current\.failureDetails/);
});
+test("a proxy fake-IP gets its own copy and names the address it came from", () => {
+ // Issue #419, third round: Clash's `198.18.0.0/15` is refused as a non-public
+ // address, but it is the proxy's placeholder for the name, not the target's
+ // own address. The panel must say so — and name both the host and the address,
+ // because `198.18.0.1` is what a user recognises as fake-IP mode.
+ assert.match(
+ panel,
+ /if \(hasFakeIpFailure\(remote\.failureKinds\)\) return t\("settings\.sklm\.remoteErrorFakeIp"\)/,
+ );
+ assert.match(panel, /previewFailure\.kind === "fake-ip"/);
+ assert.match(panel, /settings\.sklm\.previewFakeIpError/);
+ assert.match(panel, /settings\.sklm\.fakeIpHint/);
+ assert.match(panel, /settings\.sklm\.fakeIpHintPlain/);
+ // The hint names what actually happened: which host, and which address the
+ // local proxy answered with.
+ assert.match(panel, /const fakeIpFailureText = \(\) => \{/);
+ assert.match(
+ panel,
+ /t\("settings\.sklm\.fakeIpHint", \{ host: detail\.host, address: detail\.address \}\)/,
+ );
+ assert.match(panel, /remote\.failureKinds\[entry\] === "fake-ip"/);
+ // The address has to survive the state type, or the hint above cannot read it.
+ assert.match(panel, /address\?: string/);
+});
+
test("every shipped locale carries the new skill market strings", async () => {
const { readFile } = await import("node:fs/promises");
const ids = ["en", "zh-CN", "zh-TW", "de", "es", "fr", "ko", "tr"];
@@ -135,12 +160,16 @@ test("every shipped locale carries the new skill market strings", async () => {
"previewError",
"previewPolicyError",
"previewResolveError",
+ "previewFakeIpError",
"proxyHint",
"dnsHint",
+ "fakeIpHint",
+ "fakeIpHintPlain",
"failureDetail",
"retryPreview",
"remoteErrorPolicy",
"remoteErrorUnresolved",
+ "remoteErrorFakeIp",
"remoteErrorQuery",
"remotePartial",
"failureSourceHost",
diff --git a/apps/desktop/test/skill-market-policy-refusal.test.mjs b/apps/desktop/test/skill-market-policy-refusal.test.mjs
index fee31d6bf..51764998d 100644
--- a/apps/desktop/test/skill-market-policy-refusal.test.mjs
+++ b/apps/desktop/test/skill-market-policy-refusal.test.mjs
@@ -78,10 +78,11 @@ test("a resolver that throws is unresolved too, and that one is retried", async
});
test("a TUN fake-IP is still refused, and the refusal now names what it refused", async () => {
- // Clash's default fake-IP range. This *is* an address verdict, so the guard
- // keeps refusing it. What changed is the explanation: the refusal now carries
- // the host, the reason, and the class of address, instead of the one word
- // "private" that fit none of the benchmark/CGNAT/loopback cases.
+ // Clash's default fake-IP range. The guard keeps refusing it — this is a
+ // refusal, not an exemption — but it is now its own cause rather than the same
+ // finding as a real private target, and the record carries the host, the
+ // reason, the address and its class instead of the one word "private" that fit
+ // none of the benchmark/CGNAT/loopback cases.
const client = createPublicHttpsClient({
fetchImpl: async () => {
throw new Error("a refused request must never reach the network");
@@ -91,11 +92,12 @@ test("a TUN fake-IP is still refused, and the refusal now names what it refused"
const aggregator = createSkillMarketAggregator(client.request);
const result = await aggregator.search("", [composio]);
- assert.equal(result.failureKinds[composio.name], "policy");
+ assert.equal(result.failureKinds[composio.name], "fake-ip");
assert.deepEqual(result.failureDetails[composio.name], {
- kind: "policy",
+ kind: "fake-ip",
reason: "non-public-address",
host: SCAN_HOST,
+ address: "198.18.0.4",
addressKind: "benchmark",
});
});
@@ -205,6 +207,113 @@ test("all seven built-in sources stay refused under a TUN resolver, never admitt
assert.deepEqual(result.entries, []);
assert.deepEqual([...result.failedSources].sort(), sources.map((source) => source.name).sort());
for (const source of sources) {
- assert.equal(result.failureKinds[source.name], "policy");
+ assert.equal(result.failureKinds[source.name], "fake-ip");
}
});
+
+/**
+ * The fake-IP case, which the coordinator's lead puts at the centre of #419.
+ *
+ * Clash, Mihomo, sing-box and Surge all ship `198.18.0.0/15` — RFC 2544's
+ * benchmark range — as their default fake-IP pool. `classifyIpLiteral` is right
+ * to call that non-public, and the guard must keep refusing it. But that address
+ * is the *proxy's* placeholder for the name, not the target's own address, so
+ * collapsing it into the same finding as a real `10.0.0.0/8` target tells the
+ * user their catalog source is bad when the thing to change is their proxy mode.
+ */
+
+/** The market's verdict for one literal, through the real client and aggregator. */
+async function marketKindForAddress(address) {
+ const client = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("a refused request must never reach the network");
+ },
+ lookupImpl: async () => [{ address }],
+ });
+ return createSkillMarketAggregator(client.request).search("", [composio]);
+}
+
+test("a proxy fake-IP is its own cause, not the same finding as a private target", async () => {
+ // Both halves of Clash's default pool, so the range and not one address is
+ // what gets pinned.
+ assert.equal((await marketKindForAddress("198.18.0.1")).failureKinds[composio.name], "fake-ip");
+ assert.equal(
+ (await marketKindForAddress("198.19.255.254")).failureKinds[composio.name],
+ "fake-ip",
+ );
+ // A real private or loopback target is a different finding, with different
+ // advice: that one is about the destination, not about the proxy.
+ assert.equal((await marketKindForAddress("127.0.0.1")).failureKinds[composio.name], "policy");
+ assert.equal((await marketKindForAddress("10.1.2.3")).failureKinds[composio.name], "policy");
+ assert.equal((await marketKindForAddress("192.168.1.10")).failureKinds[composio.name], "policy");
+});
+
+test("the fake-IP cause never admits the request", async () => {
+ // The whole point of a separate cause is the explanation, never the outcome.
+ // This is the assertion that would fail first if the split were implemented as
+ // an exemption instead of a label.
+ let fetched = 0;
+ const client = createPublicHttpsClient({
+ fetchImpl: async () => {
+ fetched += 1;
+ return {
+ status: 200,
+ ok: true,
+ headers: { get: () => null },
+ json: async () => ({}),
+ text: async () => "",
+ };
+ },
+ lookupImpl: async () => [{ address: "198.18.0.1" }],
+ });
+ const result = await createSkillMarketAggregator(client.request).search("", [composio]);
+ assert.equal(fetched, 0, "a fake-IP answer must never be fetched through");
+ assert.deepEqual(result.entries, []);
+ assert.deepEqual(result.failedSources, [composio.name]);
+ assert.equal(result.failureKinds[composio.name], "fake-ip");
+});
+
+test("the refusal names the host and the address, not only the source label", async () => {
+ // "Catalog sources were blocked by the app's address check" named nothing. The
+ // host and the address it was resolved to are the whole diagnosis: one glance
+ // at `198.18.0.1` is what tells a user their proxy is in fake-IP mode.
+ const result = await marketKindForAddress("198.18.0.1");
+ assert.deepEqual(result.failureDetails[composio.name], {
+ kind: "fake-ip",
+ reason: "non-public-address",
+ host: SCAN_HOST,
+ address: "198.18.0.1",
+ addressKind: "benchmark",
+ });
+ const privateTarget = await marketKindForAddress("10.1.2.3");
+ assert.equal(privateTarget.failureDetails[composio.name].address, "10.1.2.3");
+ assert.equal(privateTarget.failureDetails[composio.name].addressKind, "private");
+});
+
+test("a resolver that answered nothing is not a fake-IP and not a verdict", async () => {
+ // The three cases the lead asks to keep apart, asserted side by side so a
+ // future refactor cannot merge two of them again.
+ const judgedFake = await marketKindForAddress("198.18.0.1");
+ assert.equal(judgedFake.failureKinds[composio.name], "fake-ip");
+
+ const judgedPrivate = await marketKindForAddress("10.1.2.3");
+ assert.equal(judgedPrivate.failureKinds[composio.name], "policy");
+
+ const silent = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("a refused request must never reach the network");
+ },
+ lookupImpl: async () => [],
+ });
+ const unanswered = await createSkillMarketAggregator(silent.request).search("", [composio]);
+ assert.equal(unanswered.failureKinds[composio.name], "unresolved");
+
+ const syntactic = createSkillMarketAggregator(async () => {
+ throw new Error("a syntactically refused source is never requested");
+ });
+ const refused = await syntactic.search("", [
+ { id: "x", name: "x/private", url: "https://10.0.0.8/catalog.json" },
+ ]);
+ assert.equal(refused.failureKinds["x/private"], "policy");
+ assert.equal(refused.failureDetails["x/private"].reason, "url-syntax");
+});
diff --git a/apps/desktop/test/skill-market-scan.test.mjs b/apps/desktop/test/skill-market-scan.test.mjs
index 410cd6393..76765af98 100644
--- a/apps/desktop/test/skill-market-scan.test.mjs
+++ b/apps/desktop/test/skill-market-scan.test.mjs
@@ -133,19 +133,22 @@ test("a failed source reports whether the policy or the transport refused it", a
]);
assert.deepEqual(result.entries, []);
assert.deepEqual([...result.failedSources].sort(), ["blocked/repo", "down/repo", "local"]);
- // Issue #419: a policy refusal must not be indistinguishable from a dead host
- // or from a source that never left the syntactic guard.
+ // Issue #419: a policy refusal must not be indistinguishable from a dead host,
+ // from a source that never left the syntactic guard, or from a fake-IP the
+ // local proxy invented. The address here is the proxy's placeholder for
+ // `blocked.example`, so it is reported as its own cause.
assert.deepEqual(result.failureKinds, {
- "blocked/repo": "policy",
+ "blocked/repo": "fake-ip",
"down/repo": "network",
local: "policy",
});
- // …and each name now carries what it was about, not just which bucket it
- // landed in. A transport failure answers a 502 with a bare host.
+ // …and each name carries what it was about, not just which bucket it landed
+ // in. A transport failure answers a 502 with a bare host.
assert.deepEqual(result.failureDetails["blocked/repo"], {
- kind: "policy",
+ kind: "fake-ip",
host: "blocked.example",
reason: "non-public-address",
+ address: "198.18.0.4",
addressKind: "benchmark",
});
assert.deepEqual(result.failureDetails.local, {
@@ -204,7 +207,7 @@ test("the most specific failure survives a shared display name", async () => {
{ id: "b", name: "shared", url: "https://down.example/catalog.json" },
{ id: "c", name: "shared", url: "https://judged.example/catalog.json" },
]);
- assert.equal(withJudged.failureKinds.shared, "policy");
+ assert.equal(withJudged.failureKinds.shared, "fake-ip");
assert.equal(withJudged.failureDetails.shared.reason, "non-public-address");
const withoutJudged = await createSkillMarketAggregator(request).search("", [
@@ -236,12 +239,13 @@ test("a diagnostics record names the host, never the URL or its credentials", as
// `owner/repo` source is scanned through `api.github.com`, and naming the
// repository host there would point at a host that was never refused.
host: "api.github.com",
- kind: "policy",
+ kind: "fake-ip",
reason: "non-public-address",
+ address: "198.18.0.4",
addressKind: "benchmark",
},
);
- // The class travels, the address never does.
+ // The class travels; so does the address, and what must not is the URL.
const judged = skillMarketFailureDetail(
{ name: "anthropics/skills", url: "https://github.com/anthropics/skills" },
new PublicNetworkPolicyError("hostname resolves to a non-public address: api.github.com -> 198.18.0.4", {
@@ -251,7 +255,15 @@ test("a diagnostics record names the host, never the URL or its credentials", as
addressKind: "benchmark",
}),
);
- assert.equal(JSON.stringify(judged).includes("198.18.0.4"), false);
+ // The address travels with the class: it is the local resolver's own answer for
+ // the host, and `198.18.0.4` is what a user recognises as fake-IP mode at a
+ // glance (issue #419). The URL, its path, its query and its credentials still
+ // never do.
+ assert.equal(judged.address, "198.18.0.4");
+ const serialized = JSON.stringify(judged);
+ assert.equal(serialized.includes("secret"), false);
+ assert.equal(serialized.includes("token"), false);
+ assert.equal(serialized.includes("/org/repo"), false);
// A resolver that answered nothing is not an address verdict, and the record
// must not claim one.
assert.deepEqual(
@@ -295,10 +307,23 @@ test("the classifier matches the aggregator's own classification", async () => {
const judged = new PublicNetworkPolicyError("hostname resolves to a non-public address: x.example", {
reason: "non-public-address",
host: "x.example",
+ address: "198.18.0.1",
addressKind: "benchmark",
});
+ const privateTarget = new PublicNetworkPolicyError(
+ "hostname resolves to a non-public address: x.example",
+ {
+ reason: "non-public-address",
+ host: "x.example",
+ address: "10.1.2.3",
+ addressKind: "private",
+ },
+ );
assert.equal(classifySkillMarketFailure(unresolved), "unresolved");
- assert.equal(classifySkillMarketFailure(judged), "policy");
+ // Same reason and same code, different address class — which is the whole
+ // distinction between a proxy's fake-IP and the target's own private address.
+ assert.equal(classifySkillMarketFailure(judged), "fake-ip");
+ assert.equal(classifySkillMarketFailure(privateTarget), "policy");
assert.equal(classifySkillMarketFailure(new Error("fetch failed")), "network");
const aggregator = createSkillMarketAggregator(async () => {
throw unresolved;
@@ -330,6 +355,9 @@ test("both market channels report their failures to the app log", () => {
// public" (§09 diagnostics).
assert.match(src, /reason: detail\.reason/);
assert.match(src, /addressKind: detail\.addressKind/);
+ // The address travels with the class — `198.18.0.1` is what names fake-IP mode
+ // for a user reading the log (issue #419).
+ assert.match(src, /address: detail\.address/);
assert.doesNotMatch(src, /data: \{ url|url: source\.url/);
// The registration site must supply the logger, or the wiring above is dead.
const register = readFileSync(
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 2834cf9b3..27994408e 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -547,6 +547,14 @@ sklm: {
dnsHint:
"Diese Prüfung löst den Host lokal auf, der Download selbst würde jedoch über deinen Proxy laufen. Wenn du einen Proxy, ein VPN oder ein eigenes DNS-Setup verwendest, prüfe Einstellungen → Allgemein → Netzwerk.",
failureSourceHost: "{{name}} ({{host}})",
+ remoteErrorFakeIp:
+ "Dein Proxy hat die Katalogquellen mit fake-IP-Adressen beantwortet – integrierte Auswahl wird angezeigt",
+ previewFakeIpError:
+ "Dein Proxy hat diesen Host auf eine fake-IP-Adresse aufgelöst, daher hat die Adressprüfung der App abgelehnt – es wurde nichts installiert.",
+ fakeIpHint:
+ "Dein Proxy hat {{host}} mit {{address}} beantwortet – einem reservierten Benchmark-Bereich, den Proxys als fake-IP-Platzhalter verwenden, nicht der echten Adresse der Quelle. Stelle den Proxy auf Systemproxy-Modus um oder prüfe Einstellungen → Allgemein → Netzwerk.",
+ fakeIpHintPlain:
+ "Ein lokaler Proxy hat diesen Host auf einen fake-IP-Platzhalter in einem reservierten Bereich aufgelöst, nicht auf die echte Adresse der Quelle. Stelle den Proxy auf Systemproxy-Modus um oder prüfe Einstellungen → Allgemein → Netzwerk.",
remoteErrorQuery: "Der Skill-Markt konnte nicht abgefragt werden – integrierte Auswahl wird angezeigt",
remotePartial: "Einige Katalogquellen sind nicht verfügbar ({{names}})",
},
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index 885592f9b..3c1fc2a92 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -554,6 +554,14 @@ sklm: {
dnsHint:
"That check resolves the host locally, while the download itself would use your proxy. If you use a proxy, a VPN, or a custom DNS setup, check Settings → General → Network.",
failureSourceHost: "{{name}} ({{host}})",
+ remoteErrorFakeIp:
+ "Your proxy answered the catalog sources with fake-IP addresses — showing built-in picks",
+ previewFakeIpError:
+ "Your proxy resolved this host to a fake-IP address, so the app's address check refused it — nothing was installed.",
+ fakeIpHint:
+ "Your proxy answered {{host}} with {{address}} — a reserved benchmark range that proxies use as a fake-IP placeholder, not the source's real address. Switch the proxy to system-proxy mode, or check Settings → General → Network.",
+ fakeIpHintPlain:
+ "A local proxy resolved this host to a fake-IP placeholder in a reserved range, not to the source's real address. Switch the proxy to system-proxy mode, or check Settings → General → Network.",
remoteErrorQuery: "Could not query the skill market — showing built-in picks",
remotePartial: "Some catalog sources are unavailable ({{names}})",
},
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index d8a9fc543..6fcbc6bb9 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -547,6 +547,14 @@ sklm: {
dnsHint:
"Esa comprobación resuelve el host localmente, mientras que la descarga usaría tu proxy. Si usas un proxy, una VPN o una configuración de DNS propia, revisa Ajustes → General → Red.",
failureSourceHost: "{{name}} ({{host}})",
+ remoteErrorFakeIp:
+ "Tu proxy respondió con direcciones fake-IP para las fuentes del catálogo: se muestran las selecciones integradas",
+ previewFakeIpError:
+ "Tu proxy resolvió este host a una dirección fake-IP, así que la comprobación de direcciones de la aplicación lo rechazó: no se instaló nada.",
+ fakeIpHint:
+ "Tu proxy respondió {{host}} con {{address}}, un rango de referencia reservado que los proxys usan como marcador fake-IP, no la dirección real de la fuente. Cambia el proxy al modo de proxy del sistema o revisa Ajustes → General → Red.",
+ fakeIpHintPlain:
+ "Un proxy local resolvió este host a un marcador fake-IP en un rango reservado, no a la dirección real de la fuente. Cambia el proxy al modo de proxy del sistema o revisa Ajustes → General → Red.",
remoteErrorQuery: "No se pudo consultar el mercado de skills: se muestran las selecciones integradas",
remotePartial: "Algunas fuentes del catálogo no están disponibles ({{names}})",
},
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index 2c743a09b..23a805a6c 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -547,6 +547,14 @@ sklm: {
dnsHint:
"Ce contrôle résout l'hôte localement, alors que le téléchargement passerait par votre proxy. Si vous utilisez un proxy, un VPN ou une configuration DNS personnalisée, vérifiez Paramètres → Général → Réseau.",
failureSourceHost: "{{name}} ({{host}})",
+ remoteErrorFakeIp:
+ "Votre proxy a répondu avec des adresses fake-IP pour les sources du catalogue – sélection intégrée affichée",
+ previewFakeIpError:
+ "Votre proxy a résolu cet hôte en une adresse fake-IP ; le contrôle d'adresse de l'application l'a donc refusé – rien n'a été installé.",
+ fakeIpHint:
+ "Votre proxy a répondu {{host}} avec {{address}}, une plage de référence réservée que les proxys utilisent comme adresse factice, et non l'adresse réelle de la source. Passez le proxy en mode proxy système, ou vérifiez Paramètres → Général → Réseau.",
+ fakeIpHintPlain:
+ "Un proxy local a résolu cet hôte en une adresse factice d'une plage réservée, et non en l'adresse réelle de la source. Passez le proxy en mode proxy système, ou vérifiez Paramètres → Général → Réseau.",
remoteErrorQuery: "Impossible d'interroger le marché de skills – sélection intégrée affichée",
remotePartial: "Certaines sources du catalogue sont indisponibles ({{names}})",
},
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index 295895a41..42e9c5781 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -556,6 +556,14 @@ sklm: {
dnsHint:
"이 검사는 호스트를 로컬에서 확인하지만, 다운로드 자체는 프록시를 사용합니다. 프록시, VPN 또는 별도 DNS 설정을 사용한다면 설정 → 일반 → 네트워크를 확인하세요.",
failureSourceHost: "{{name}} ({{host}})",
+ remoteErrorFakeIp:
+ "프록시가 카탈로그 소스에 fake-IP 주소로 응답했습니다. 내장 목록을 표시합니다",
+ previewFakeIpError:
+ "프록시가 이 호스트를 fake-IP 주소로 확인했고, 앱의 주소 검사가 이를 거부했습니다. 아무것도 설치되지 않았습니다.",
+ fakeIpHint:
+ "프록시가 {{host}}를 {{address}}로 응답했습니다. 이는 프록시가 fake-IP 자리표시자로 사용하는 예약된 벤치마크 대역이며, 소스의 실제 주소가 아닙니다. 프록시를 시스템 프록시 모드로 전환하거나 설정 → 일반 → 네트워크를 확인하세요.",
+ fakeIpHintPlain:
+ "로컬 프록시가 이 호스트를 예약 대역의 fake-IP 자리표시자로 확인했습니다. 소스의 실제 주소가 아닙니다. 프록시를 시스템 프록시 모드로 전환하거나 설정 → 일반 → 네트워크를 확인하세요.",
remoteErrorQuery: "스킬 마켓을 조회하지 못했습니다. 내장 목록을 표시합니다",
remotePartial: "일부 카탈로그 소스를 사용할 수 없습니다 ({{names}})",
},
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index 6194ba453..d27375b1c 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -556,6 +556,14 @@ sklm: {
dnsHint:
"Bu denetim ana bilgisayarı yerel olarak çözer, indirmenin kendisi ise proxy'nizden geçer. Proxy, VPN veya özel bir DNS kurulumu kullanıyorsanız Ayarlar → Genel → Ağ bölümünü kontrol edin.",
failureSourceHost: "{{name}} ({{host}})",
+ remoteErrorFakeIp:
+ "Proxy'niz katalog kaynaklarına fake-IP adresleriyle yanıt verdi – yerleşik seçkiler gösteriliyor",
+ previewFakeIpError:
+ "Proxy'niz bu ana bilgisayarı bir fake-IP adresine çözdü, bu yüzden uygulamanın adres denetimi reddetti – hiçbir şey yüklenmedi.",
+ fakeIpHint:
+ "Proxy'niz {{host}} için {{address}} yanıtını verdi; bu, proxy'lerin fake-IP yer tutucusu olarak kullandığı ayrılmış bir referans aralığıdır, kaynağın gerçek adresi değildir. Proxy'yi sistem proxy moduna alın veya Ayarlar → Genel → Ağ bölümünü kontrol edin.",
+ fakeIpHintPlain:
+ "Yerel bir proxy bu ana bilgisayarı ayrılmış bir aralıktaki fake-IP yer tutucusuna çözdü; kaynağın gerçek adresi değildir. Proxy'yi sistem proxy moduna alın veya Ayarlar → Genel → Ağ bölümünü kontrol edin.",
remoteErrorQuery: "Skill market sorgulanamadı – yerleşik seçkiler gösteriliyor",
remotePartial: "Bazı katalog kaynakları kullanılamıyor ({{names}})",
},
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 8cb6faac8..e33c9ee41 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -549,6 +549,12 @@ sklm: {
dnsHint:
"该校验在本机解析主机,而下载本身会走代理。如果你使用代理、VPN 或自定义 DNS,请检查 设置 → 通用 → 网络。",
failureSourceHost: "{{name}}({{host}})",
+ remoteErrorFakeIp: "代理用 fake-IP 地址应答了目录源,已显示内置精选",
+ previewFakeIpError: "代理把该主机解析成了 fake-IP 地址,应用的地址校验因此拒绝,未安装任何内容。",
+ fakeIpHint:
+ "代理把 {{host}} 应答为 {{address}} —— 这是代理用作 fake-IP 占位地址的保留基准测试段,不是该源的真实地址。请把代理切换为系统代理模式,或检查 设置 → 通用 → 网络。",
+ fakeIpHintPlain:
+ "本地代理把该主机解析成了保留段里的 fake-IP 占位地址,而不是该源的真实地址。请把代理切换为系统代理模式,或检查 设置 → 通用 → 网络。",
remoteErrorQuery: "无法查询技能市场,已显示内置精选",
remotePartial: "部分目录源不可用({{names}})",
},
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index c454520ab..0e832760a 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -549,6 +549,12 @@ sklm: {
dnsHint:
"該校驗在本機解析主機,而下載本身會走代理。如果你使用代理、VPN 或自訂 DNS,請檢查 設定 → 一般 → 網路。",
failureSourceHost: "{{name}}({{host}})",
+ remoteErrorFakeIp: "代理以 fake-IP 位址回應了目錄源,已顯示內建精選",
+ previewFakeIpError: "代理將該主機解析成 fake-IP 位址,應用程式的地址校驗因此拒絕,未安裝任何內容。",
+ fakeIpHint:
+ "代理將 {{host}} 回應為 {{address}} —— 這是代理用作 fake-IP 佔位位址的保留基準測試段,不是該來源的真實位址。請將代理切換為系統代理模式,或檢查 設定 → 一般 → 網路。",
+ fakeIpHintPlain:
+ "本機代理將該主機解析成保留段中的 fake-IP 佔位位址,而不是該來源的真實位址。請將代理切換為系統代理模式,或檢查 設定 → 一般 → 網路。",
remoteErrorQuery: "無法查詢技能市場,已顯示內建精選",
remotePartial: "部分目錄源不可用({{names}})",
},
diff --git a/packages/shared/src/public-network.test.ts b/packages/shared/src/public-network.test.ts
index 9d419ba0e..d6ee8313f 100644
--- a/packages/shared/src/public-network.test.ts
+++ b/packages/shared/src/public-network.test.ts
@@ -6,6 +6,7 @@ import {
isPublicIpLiteral,
PUBLIC_NETWORK_POLICY_ERROR,
isPublicHostname,
+ isProxyFakeIpAddress,
isPublicNetworkPolicyFailure,
publicNetworkRefusalDetail,
publicNetworkRefusalReason,
@@ -117,8 +118,11 @@ describe("public network address policy", () => {
expect(publicNetworkRefusalReason({ name: PUBLIC_NETWORK_POLICY_ERROR, reason: "made-up" })).toBeUndefined();
expect(publicNetworkRefusalDetail({ name: PUBLIC_NETWORK_POLICY_ERROR })).toBeUndefined();
expect(isPublicNetworkPolicyFailure({ name: PUBLIC_NETWORK_POLICY_ERROR })).toBe(true);
- // The class travels, the address never does: `benchmark` is a TUN fake-IP
- // and `private` is a real RFC1918 target, and only the class separates them.
+ // The class and the address both travel: the address is what the user
+ // recognises (`198.18.0.1` is unmistakably a proxy's fake-IP) and the class
+ // is what a machine decides on. `isProxyFakeIpAddress` is the one place that
+ // turns "benchmark" into "a proxy invented this", and it never turns it into
+ // permission — the guard still refuses the address.
expect(
publicNetworkRefusalDetail({
name: PUBLIC_NETWORK_POLICY_ERROR,
@@ -127,7 +131,16 @@ describe("public network address policy", () => {
address: "198.18.0.4",
addressKind: "benchmark",
}),
- ).toEqual({ reason: "non-public-address", host: "api.github.com", addressKind: "benchmark" });
+ ).toEqual({
+ reason: "non-public-address",
+ host: "api.github.com",
+ address: "198.18.0.4",
+ addressKind: "benchmark",
+ });
+ expect(isProxyFakeIpAddress("benchmark")).toBe(true);
+ expect(isProxyFakeIpAddress("private")).toBe(false);
+ expect(isProxyFakeIpAddress("loopback")).toBe(false);
+ expect(isProxyFakeIpAddress(undefined)).toBe(false);
// An unknown class is dropped rather than passed through.
expect(
publicNetworkRefusalDetail({
@@ -136,6 +149,16 @@ describe("public network address policy", () => {
addressKind: "made-up",
}),
).toEqual({ reason: "non-public-address" });
+ // Only a well-formed IP literal travels: a refusal must never become a
+ // channel for arbitrary resolver text.
+ expect(
+ publicNetworkRefusalDetail({
+ name: PUBLIC_NETWORK_POLICY_ERROR,
+ reason: "non-public-address",
+ address: "not-an-address",
+ addressKind: "benchmark",
+ }),
+ ).toEqual({ reason: "non-public-address", addressKind: "benchmark" });
expect(publicNetworkRefusalDetail(new Error("responded 502"))).toBeUndefined();
expect(publicNetworkRefusalDetail(undefined)).toBeUndefined();
});
diff --git a/packages/shared/src/public-network.ts b/packages/shared/src/public-network.ts
index bcc2b3a9e..375932c84 100644
--- a/packages/shared/src/public-network.ts
+++ b/packages/shared/src/public-network.ts
@@ -188,7 +188,14 @@ export type PublicNetworkRefusalDetail = {
reason: PublicNetworkRefusalReason;
/** The hostname the guard was classifying, when it got that far. */
host?: string;
- /** The class of the address that failed the policy, never the address. */
+ /**
+ * The address that failed the policy, validated as an IP literal before it is
+ * carried. It is the local resolver's answer for `host`, not the user's input
+ * and not a URL component, and it is the single most diagnostic field a
+ * refusal has: `198.18.0.1` reads as a proxy's fake-IP at a glance.
+ */
+ address?: string;
+ /** That address's class, which is what separates a proxy artifact from a target. */
addressKind?: PublicNetworkAddressKind;
};
@@ -209,26 +216,51 @@ const PUBLIC_NETWORK_ADDRESS_KINDS: ReadonlyArray<PublicNetworkAddressKind> = [
];
/**
- * What a refusal says about itself: why, which host, and which class of address
- * failed. Callers that must explain a block — the skill market's classifier and
- * its diagnostics — read this instead of parsing the message. `addressKind`
- * travels without the address: the class is what separates a resolver artifact
- * (`benchmark`, a TUN fake-IP) from a real private target (`private`, RFC1918),
- * and it is not a secret.
+ * The address classes a local proxy hands back for a name it means to resolve
+ * itself, instead of the target's own address. `benchmark` is RFC 2544's
+ * `198.18.0.0/15`, which Clash, Mihomo, sing-box and Surge all ship as their
+ * default fake-IP pool — and `2001:2::/48` in IPv6.
+ *
+ * A caller uses this to explain a block correctly, never to lift one: an address
+ * in this class still fails `isPublicIpLiteral`, and the guard still refuses it
+ * (issue #419).
+ */
+export function isProxyFakeIpAddress(kind: PublicNetworkAddressKind | undefined): boolean {
+ return kind === "benchmark";
+}
+
+/**
+ * What a refusal says about itself: why, which host, which address it resolved
+ * to, and which class that address fell into. Callers that must explain a block
+ * — the skill market's classifier and its diagnostics — read this instead of
+ * parsing the message.
+ *
+ * The address and its class travel together: the address is what the user
+ * recognises (`198.18.0.1` is unmistakably a proxy's fake-IP) and the class is
+ * what a machine decides on. Neither is a secret — both are the local resolver's
+ * answer for a hostname the user supplied — and neither is a URL, a path, a
+ * query or a credential.
*/
export function publicNetworkRefusalDetail(error: unknown): PublicNetworkRefusalDetail | undefined {
const reason = publicNetworkRefusalReason(error);
if (!reason) return undefined;
- const source = error as { host?: unknown; addressKind?: unknown };
+ const source = error as { host?: unknown; address?: unknown; addressKind?: unknown };
const host = typeof source.host === "string" && source.host ? source.host : undefined;
const addressKind = PUBLIC_NETWORK_ADDRESS_KINDS.includes(
source.addressKind as PublicNetworkAddressKind,
)
? (source.addressKind as PublicNetworkAddressKind)
: undefined;
+ // Only a well-formed IP literal travels: a refusal must never be a channel for
+ // putting arbitrary resolver text into a log line or a settings page.
+ const address =
+ typeof source.address === "string" && classifyIpLiteral(source.address) !== "invalid"
+ ? source.address
+ : undefined;
return {
reason,
...(host ? { host } : {}),
+ ...(address ? { address } : {}),
...(addressKind ? { addressKind } : {}),
};
}