Files
OmniRoute/src/shared/constants/mitmToolHosts.ts
Diego Rodrigues de Sa e Souza 764d91fdfa fix(oauth): mirror ghe-copilot into the OAuth id map and MITM host list
#7546 registered the ghe-copilot provider in src/lib/oauth/providers/index.ts but
left it out of two mirrors that are asserted to stay in lock-step:

- PROVIDERS in src/lib/oauth/constants/oauth.ts (the canonical id map), which made
  oauth-providers-config.test.ts fail three assertions at once;
- MITM_TOOL_HOSTS, the client-safe projection of ALL_TARGETS, which made
  mitm-tool-hosts.test.ts fail its drift guard.

Both reds reproduce on the pure release tip and turned every open PR's unit shards
red, so this unblocks the whole queue. The test expectations are extended (not
weakened) to cover the new provider.
2026-07-20 06:52:05 -03:00

35 lines
1.5 KiB
TypeScript

/**
* Per-tool MITM DNS hosts — the domains redirected to 127.0.0.1 when a tool's MITM DNS
* routing is enabled. Surfaced in the dashboard so users on locked-down machines (where the
* automatic hosts-file edit needs admin/sudo) can add the entries manually.
*
* This is a CLIENT-SAFE projection of the canonical server-side registry in
* `src/mitm/targets/`. The MITM target modules pull in node-only handler logic, so the
* dashboard cannot import them directly — this plain-data map is kept in lock-step with
* `ALL_TARGETS` by `tests/unit/mitm-tool-hosts.test.ts` (a drift here fails that test).
*/
export const MITM_TOOL_HOSTS: Record<string, string[]> = {
antigravity: [
"daily-cloudcode-pa.googleapis.com",
"cloudcode-pa.googleapis.com",
"daily-cloudcode-pa.sandbox.googleapis.com",
"autopush-cloudcode-pa.sandbox.googleapis.com",
],
kiro: ["api.anthropic.com"],
copilot: ["api.githubcopilot.com", "copilot-proxy.githubusercontent.com"],
// GHE Copilot has no fixed host: the enterprise domain is per-connection (gheUrl), so the
// canonical target declares an empty host list and nothing is added to the hosts file.
"ghe-copilot": [],
codex: ["chatgpt.com"],
cursor: ["api2.cursor.sh"],
zed: ["api.zed.dev"],
"claude-code": ["api.anthropic.com"],
"open-code": ["opencode.ai"],
trae: ["trae.invalid"],
};
/** Hosts for a tool id, falling back to an empty list for unknown ids. */
export function getMitmToolHosts(toolId: string): string[] {
return MITM_TOOL_HOSTS[toolId] ?? [];
}