mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-03 20:21:51 +08:00
feat(traffic,sandbox): add TUN/netstack transparent gateway, egress controls, CAP_NET_RAW hardening, and i18n fixes
- Implement full-traffic transparent gateway (cmd/artex-gateway, traffic/netstack.go, traffic/transparent.go) using Linux TUN + gVisor netstack deferred TCP handshakes (eliminating nmap/nc false-positive open ports), real ICMPv4 Echo proxying, UDP/DNS interception, and per-container upstream proxy overrides. - Add egress blacklist + asset-intercept sync, non-HTTP flow/DNS SQLite persistence and APIs, and /system/proxy & /function/traffic TCP/UDP/DNS UI panels. - Fix sandbox Playwright MCP browser loopback --proxy-server rewrite and NODE_EXTRA_CA_CERTS override in server/mcpstdio.go. - Strip all SUID/SGID binaries in Dockerfile.sandbox, grant minimal cap_net_raw+ep to nmap/nping/ping with ARTEX_SANDBOX_ALLOW_NET_RAW toggle, and enforce IPv4/IPv6 anti-spoofing in iptables and netstack. - Remove hardcoded Chinese "(全局)" from GET /api/proxy/routes, localize ContainerRoutesTab / NonHTTPTrafficPanel labels, and expose reactive locale/isEn from useLiveTranslation for React Compiler compatibility.
This commit is contained in:
1 parent
9c43e694a3
commit
d786de90af
69 files changed
+13082
-1433
No files matched your search
+105
-5
@@ -24,6 +24,7 @@ import type {
|
||||
Company,
|
||||
CompanyScopeMutation,
|
||||
CompanyScopeRule,
|
||||
ContainerProxyRoute,
|
||||
Conversation,
|
||||
ConvTokenSummary,
|
||||
CoverageAssetRefs,
|
||||
@@ -33,6 +34,8 @@ import type {
|
||||
DeleteTaskOptions,
|
||||
DeleteTaskResult,
|
||||
Edge,
|
||||
EgressBlacklistRule,
|
||||
EgressBlacklistState,
|
||||
EgressReport,
|
||||
EvidenceBodyPreview,
|
||||
ExplorationNodePage,
|
||||
@@ -80,9 +83,13 @@ import type {
|
||||
PromptVar,
|
||||
PromptVersion,
|
||||
ProxyPoolEntry,
|
||||
ProxyRoutesState,
|
||||
ProxySwitchLog,
|
||||
RepeaterSendRequest,
|
||||
RepeaterSendResponse,
|
||||
SandboxContainerInfo,
|
||||
SandboxGlobalStatus,
|
||||
SandboxRuntimeOverrides,
|
||||
SessionTokenUsage,
|
||||
Settings,
|
||||
Severity,
|
||||
@@ -112,15 +119,15 @@ import type {
|
||||
Tool,
|
||||
ToolStat,
|
||||
TrafficDetail,
|
||||
TrafficDNSResp,
|
||||
TrafficEvidenceRef,
|
||||
TrafficEvidenceRole,
|
||||
TrafficHost,
|
||||
TrafficNetFlow,
|
||||
TrafficNetFlowsResp,
|
||||
TrafficResp,
|
||||
UpdateCheck,
|
||||
UpdateSettings,
|
||||
SandboxContainerInfo,
|
||||
SandboxGlobalStatus,
|
||||
SandboxRuntimeOverrides,
|
||||
UsageStats,
|
||||
WorkspaceFile,
|
||||
WorkspaceListing,
|
||||
@@ -1163,6 +1170,9 @@ export const api = {
|
||||
q = "",
|
||||
opts: {
|
||||
taskId?: string;
|
||||
scope?: string;
|
||||
ownerId?: string;
|
||||
containerId?: string;
|
||||
body?: string;
|
||||
path?: string;
|
||||
status?: string;
|
||||
@@ -1175,6 +1185,9 @@ export const api = {
|
||||
get<TrafficResp>(
|
||||
`/traffic?page=${page}&size=${size}` +
|
||||
(opts.taskId ? `&task_id=${encodeURIComponent(opts.taskId)}` : "") +
|
||||
(opts.scope && opts.scope !== "all" ? `&scope=${encodeURIComponent(opts.scope)}` : "") +
|
||||
(opts.ownerId ? `&owner_id=${encodeURIComponent(opts.ownerId)}` : "") +
|
||||
(opts.containerId ? `&container_id=${encodeURIComponent(opts.containerId)}` : "") +
|
||||
(host ? `&host=${encodeURIComponent(host)}` : "") +
|
||||
(method && method !== "all" ? `&method=${encodeURIComponent(method)}` : "") +
|
||||
(q ? `&q=${encodeURIComponent(q)}` : "") +
|
||||
@@ -1818,8 +1831,7 @@ export const api = {
|
||||
rollbackUpdate: () => post<{ ok: boolean }>(`/update/rollback`),
|
||||
|
||||
// ---- Sandbox container isolation ----
|
||||
sandboxStatus: (withStats = false) =>
|
||||
get<SandboxGlobalStatus>(`/sandbox/status${withStats ? "?stats=1" : ""}`),
|
||||
sandboxStatus: (withStats = false) => get<SandboxGlobalStatus>(`/sandbox/status${withStats ? "?stats=1" : ""}`),
|
||||
updateSandboxSettings: (ov: SandboxRuntimeOverrides) => put<SandboxGlobalStatus>("/sandbox/settings", ov),
|
||||
pruneSandboxContainers: () => post<{ removed: number }>("/sandbox/prune"),
|
||||
sandboxContainer: (scope: string, ownerID: string, withStats = true) =>
|
||||
@@ -1849,4 +1861,92 @@ export const api = {
|
||||
post<SandboxContainerInfo>(`/tasks/${encodeURIComponent(taskID)}/sandbox/stop`, { pause_task: pauseTask }),
|
||||
recreateTaskSandbox: (taskID: string, opts?: { pause_task?: boolean; clear_workspace?: boolean }) =>
|
||||
post<SandboxContainerInfo>(`/tasks/${encodeURIComponent(taskID)}/sandbox/recreate`, opts ?? {}),
|
||||
|
||||
// ---- Proxy Egress Blacklist (#218) ----
|
||||
egressBlacklist: () => get<EgressBlacklistState>("/proxy/blacklist"),
|
||||
updateEgressBlacklistSettings: (syncAssetIntercept: boolean) =>
|
||||
put<EgressBlacklistState>("/proxy/blacklist/settings", { sync_asset_intercept: syncAssetIntercept }),
|
||||
createEgressBlacklistRule: (rule: {
|
||||
enabled?: boolean;
|
||||
kind: string;
|
||||
pattern: string;
|
||||
port?: number;
|
||||
note?: string;
|
||||
}) => post<EgressBlacklistRule>("/proxy/blacklist/rules", rule),
|
||||
updateEgressBlacklistRule: (
|
||||
id: string,
|
||||
patch: { enabled?: boolean; kind?: string; pattern?: string; port?: number; note?: string },
|
||||
) => put<EgressBlacklistRule>(`/proxy/blacklist/rules/${encodeURIComponent(id)}`, patch),
|
||||
deleteEgressBlacklistRule: (id: string) =>
|
||||
del<{ deleted: string }>(`/proxy/blacklist/rules/${encodeURIComponent(id)}`),
|
||||
clearEgressBlockEvents: () => del<{ cleared: boolean }>("/proxy/blacklist/events"),
|
||||
|
||||
// ---- Non-HTTP Traffic (TCP/UDP Flows & DNS Queries, #218 Phase 3/4) ----
|
||||
trafficFlows: (params?: {
|
||||
protocol?: string;
|
||||
action?: string;
|
||||
task_id?: string;
|
||||
scope?: string;
|
||||
owner_id?: string;
|
||||
container_id?: string;
|
||||
q?: string;
|
||||
page?: number;
|
||||
size?: number;
|
||||
}) => {
|
||||
const qs = new URLSearchParams();
|
||||
if (params?.protocol && params.protocol !== "all") qs.set("protocol", params.protocol);
|
||||
if (params?.action && params.action !== "all") qs.set("action", params.action);
|
||||
if (params?.task_id) qs.set("task_id", params.task_id);
|
||||
if (params?.scope) qs.set("scope", params.scope);
|
||||
if (params?.owner_id) qs.set("owner_id", params.owner_id);
|
||||
if (params?.container_id) qs.set("container_id", params.container_id);
|
||||
if (params?.q) qs.set("q", params.q);
|
||||
if (params?.page !== undefined) qs.set("page", String(params.page));
|
||||
if (params?.size !== undefined) qs.set("size", String(params.size));
|
||||
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
||||
return get<TrafficNetFlowsResp>(`/traffic/flows${suffix}`);
|
||||
},
|
||||
trafficFlowDetail: (id: string) => get<TrafficNetFlow>(`/traffic/flows/${encodeURIComponent(id)}`),
|
||||
deleteTrafficFlows: (taskId?: string) =>
|
||||
del<{ deleted: number }>(`/traffic/flows${taskId ? `?task_id=${encodeURIComponent(taskId)}` : ""}`),
|
||||
trafficDNS: (params?: {
|
||||
qtype?: string;
|
||||
rcode?: string;
|
||||
action?: string;
|
||||
task_id?: string;
|
||||
scope?: string;
|
||||
owner_id?: string;
|
||||
container_id?: string;
|
||||
q?: string;
|
||||
page?: number;
|
||||
size?: number;
|
||||
}) => {
|
||||
const qs = new URLSearchParams();
|
||||
if (params?.qtype && params.qtype !== "ALL") qs.set("qtype", params.qtype);
|
||||
if (params?.rcode && params.rcode !== "ALL") qs.set("rcode", params.rcode);
|
||||
if (params?.action && params.action !== "all") qs.set("action", params.action);
|
||||
if (params?.task_id) qs.set("task_id", params.task_id);
|
||||
if (params?.scope) qs.set("scope", params.scope);
|
||||
if (params?.owner_id) qs.set("owner_id", params.owner_id);
|
||||
if (params?.container_id) qs.set("container_id", params.container_id);
|
||||
if (params?.q) qs.set("q", params.q);
|
||||
if (params?.page !== undefined) qs.set("page", String(params.page));
|
||||
if (params?.size !== undefined) qs.set("size", String(params.size));
|
||||
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
||||
return get<TrafficDNSResp>(`/traffic/dns${suffix}`);
|
||||
},
|
||||
deleteTrafficDNS: (taskId?: string) =>
|
||||
del<{ deleted: number }>(`/traffic/dns${taskId ? `?task_id=${encodeURIComponent(taskId)}` : ""}`),
|
||||
|
||||
// ---- Per-Container Proxy Routes & Transparent Gateway (#218 Phase 3/4) ----
|
||||
proxyRoutes: () => get<ProxyRoutesState>("/proxy/routes"),
|
||||
putProxyRoute: (
|
||||
scope: string,
|
||||
ownerId: string,
|
||||
body: { mode: string; proxy_pool_id?: string; proxy_url?: string; note?: string },
|
||||
) => put<ContainerProxyRoute>(`/proxy/routes/${encodeURIComponent(scope)}/${encodeURIComponent(ownerId)}`, body),
|
||||
deleteProxyRoute: (scope: string, ownerId: string) =>
|
||||
del<{ deleted: string }>(`/proxy/routes/${encodeURIComponent(scope)}/${encodeURIComponent(ownerId)}`),
|
||||
updateGatewaySettings: (body: { udp_policy: string; dns_upstream: string }) =>
|
||||
put<{ udp_policy: string; dns_upstream: string }>("/proxy/gateway/settings", body),
|
||||
};
|
||||
Reference in new issue
Block a user