mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-26 01:41:04 +08:00
server: start degraded where agent isolation cannot be built
The isolation self-test stopped every start it failed, so a non-root server (the systemd unit), dev.sh, Windows and macOS no longer started without -dev-insecure-no-isolation. EnforceIsolation now decides from the platform and the privilege drop: - self-test passed: isolated; - Linux with the privilege drop on (root, the Docker image): a failure stops the start, unless -dev-insecure-no-isolation is set; - elsewhere (not Linux, not root, -exec-uid=-1): the server starts degraded, without a flag. A degraded start logs a banner with the self-test failure and what is exposed, and GET /api/health reports the isolation status to a signed-in caller; the web UI shows a red banner on every page while it is degraded. The systemd deployment guide and dev.sh describe the mode.
This commit is contained in:
@@ -43,6 +43,8 @@ export function MainContent({ children }: { children: ReactNode }) {
|
||||
const [version, setVersion] = useState("");
|
||||
// Only set when the backend has the opt-in update check on (ARTEX_UPDATE_CHECK) and found a newer release.
|
||||
const [latest, setLatest] = useState("");
|
||||
// Set when the server started with agent isolation degraded (server/isolation.go): the self-test failure.
|
||||
const [degraded, setDegraded] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
api
|
||||
@@ -51,10 +53,25 @@ export function MainContent({ children }: { children: ReactNode }) {
|
||||
setVersion((h.version ?? "").replace(/^v(?=\d)/, ""));
|
||||
const l = h.latest_version ?? "";
|
||||
setLatest(l && getLocalStorageValue(UPDATE_DISMISSED_KEY) !== l ? l : "");
|
||||
setDegraded(h.isolation?.mode === "degraded" ? (h.isolation.reason ?? "") : null);
|
||||
})
|
||||
.catch(() => setVersion(""));
|
||||
}, []);
|
||||
|
||||
// Not dismissible: it stays as long as the server runs without agent isolation.
|
||||
const isolationBanner =
|
||||
degraded !== null ? (
|
||||
<div
|
||||
role="alert"
|
||||
title={degraded}
|
||||
className="flex shrink-0 items-center justify-center gap-2 border-b border-destructive/40 bg-destructive/10 px-4 py-1 text-destructive text-xs"
|
||||
>
|
||||
{t(
|
||||
"Agent isolation is degraded: agent shells, tools and file tools run with the server's identity and may read its keys, config and database credentials.",
|
||||
)}
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
const updateBanner = latest ? (
|
||||
<div className="flex shrink-0 items-center justify-center gap-2 border-b bg-muted/50 px-4 py-1 text-xs">
|
||||
<a href={RELEASES_URL} target="_blank" rel="noreferrer" className="underline-offset-2 hover:underline">
|
||||
@@ -77,6 +94,7 @@ export function MainContent({ children }: { children: ReactNode }) {
|
||||
if (isFullBleed(pathname)) {
|
||||
return (
|
||||
<>
|
||||
{isolationBanner}
|
||||
{updateBanner}
|
||||
{children}
|
||||
</>
|
||||
@@ -85,6 +103,7 @@ export function MainContent({ children }: { children: ReactNode }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{isolationBanner}
|
||||
{updateBanner}
|
||||
<header
|
||||
className={cn(
|
||||
|
||||
@@ -214,6 +214,7 @@
|
||||
"Agent": "Ajan",
|
||||
"Agent \"{name}\" created": "\"{name}\" ajanı oluşturuldu",
|
||||
"Agent \"{name}\" deleted": "\"{name}\" ajanı silindi",
|
||||
"Agent isolation is degraded: agent shells, tools and file tools run with the server's identity and may read its keys, config and database credentials.": "Ajan yalıtımı düşürüldü: ajan kabukları, araçları ve dosya araçları sunucunun kimliğiyle çalışıyor ve anahtarlarını, yapılandırmasını ve veritabanı kimlik bilgilerini okuyabilir.",
|
||||
"Agent is replying; type /btw to ask a side question…": "Ajan yanıt veriyor; yan soru sormak için /btw yazın…",
|
||||
"Agent is running": "Ajan çalışıyor",
|
||||
"Agent list": "Ajan listesi",
|
||||
|
||||
@@ -214,6 +214,7 @@
|
||||
"Agent": "智能体",
|
||||
"Agent \"{name}\" created": "已创建智能体“{name}”",
|
||||
"Agent \"{name}\" deleted": "已删除智能体“{name}”",
|
||||
"Agent isolation is degraded: agent shells, tools and file tools run with the server's identity and may read its keys, config and database credentials.": "Agent 隔离已降级:Agent 的 shell、工具和文件工具以服务器身份运行,可能读取其密钥、配置和数据库凭据。",
|
||||
"Agent is replying; type /btw to ask a side question…": "Agent 正在回复,可输入 /btw 提问…",
|
||||
"Agent is running": "Agent 正在运行",
|
||||
"Agent list": "Agent 清单",
|
||||
|
||||
+9
-1
@@ -271,7 +271,15 @@ function interceptPageQuery(page: number, size: number, filter: InterceptApprova
|
||||
|
||||
export const api = {
|
||||
// Backend application version (injected via ldflags at release, default "dev").
|
||||
health: () => get<{ ok: boolean; service: string; version: string; latest_version?: string }>("/health"),
|
||||
// isolation: result of the startup agent isolation self-test; "degraded" shows a banner on every page.
|
||||
health: () =>
|
||||
get<{
|
||||
ok: boolean;
|
||||
service: string;
|
||||
version: string;
|
||||
latest_version?: string;
|
||||
isolation?: { mode: "isolated" | "degraded"; reason?: string };
|
||||
}>("/health"),
|
||||
|
||||
// ---- auth ----
|
||||
authStatus: () => get<{ initialized: boolean }>("/auth/status"),
|
||||
|
||||
Reference in New Issue
Block a user