fix(sqlite): validate ssh backup and query errors

This commit is contained in:
skyler authored and GitHub committed 2026-08-30 13:30:00 +08:00
1 parent e6f8b2187a
commit 9190554e50
58 files changed
+2815 -149

No files matched your search

@@ -55,7 +55,7 @@ import { doltSystemTablesVisible, isDoltDriverProfile, setDoltSystemTablesVisibl
import { DamengJvmSystemPropertyError, damengJvmSystemPropertiesText, parseDamengJvmSystemProperties } from "@/lib/database/damengJvmOptions";
import { copyToClipboard } from "@/lib/common/clipboard";
import { configuredDatabaseProductName, connectionConfigFingerprint, databaseInfoCopyText, databaseInfoRows, normalizeDatabaseConnectionInfo, type DatabaseInfoField } from "@/lib/connection/connectionDatabaseInfo";
import { agentDriverInstallKey, appendAgentDriverUpdateHint, hasAgentDriverUpdate, showAgentDriverInstallHint, type AgentDriverInstallState, type DriverStoreFocus } from "@/lib/connection/agentDriverInstallHint";
import { agentDriverInstallKey, appendAgentDriverUpdateHint, connectionUsesSsh, hasAgentDriverUpdate, showAgentDriverInstallHint, type AgentDriverInstallState, type DriverStoreFocus } from "@/lib/connection/agentDriverInstallHint";
import { prestoSqlBuiltinDriverPaths } from "@/lib/database/prestoSqlBuiltinDriver";
import { JDBCX_DEFAULT_URL, JDBCX_DRIVER_PROFILE, JDBCX_JDBC_DRIVER_CLASS, ensureJdbcxRuntimeDrivers, isJdbcxRuntimeBundle, isJdbcxRuntimePath, jdbcxHighPrivilegeExtensionsEnabled, setJdbcxHighPrivilegeExtensionsEnabled } from "@/lib/database/jdbcxBuiltinDriver";
import { SQLITE_DATABASE_FILE_EXTENSIONS } from "@/lib/database/databaseFileDetection";
@@ -1726,7 +1726,7 @@ function errorMessage(error: unknown): string {
function connectionErrorWithDriverUpdateHint(config: ConnectionConfig, message: string): string {
message = appendConnectionErrorHints(config, message, t);
if (!hasAgentDriverUpdate(config.db_type, agentDrivers.value, config.driver_profile)) return message;
if (!hasAgentDriverUpdate(config.db_type, agentDrivers.value, config.driver_profile, { ssh: connectionUsesSsh(config) })) return message;
return appendAgentDriverUpdateHint(message, t("connection.agentDriverUpdateConnectionHint"));
}
@@ -1838,11 +1838,11 @@ async function ensureRequiredAgentDriverInstalled(config: ConnectionConfig): Pro
await installSqlServerLegacyCompatibilityComponentIfNeeded();
}
const driverKey = agentDriverInstallKey(config.db_type, config.driver_profile);
const driverKey = agentDriverInstallKey(config.db_type, config.driver_profile, { ssh: connectionUsesSsh(config) });
if (!driverKey) return;
let drivers = agentDrivers.value.length ? agentDrivers.value : await refreshLocalAgentDrivers();
if (!showAgentDriverInstallHint(config.db_type, drivers, config.driver_profile)) return;
if (!showAgentDriverInstallHint(config.db_type, drivers, config.driver_profile, { ssh: connectionUsesSsh(config) })) return;
if (installedAgentDriver(drivers, driverKey)?.installed === true) return;
drivers = await refreshLocalAgentDrivers();
@@ -2659,7 +2659,11 @@ const selectedSshLayer = computed(() => (selectedTransportLayer.value?.type ===
const selectedProxyLayer = computed(() => (selectedTransportLayer.value?.type === "proxy" ? selectedTransportLayer.value : null));
const selectedHttpTunnelLayer = computed(() => (selectedTransportLayer.value?.type === "http_tunnel" ? selectedTransportLayer.value : null));
const tunnelProfiles = computed(() => tunnelProfileStore.profiles);
const tunnelProfiles = computed(() => {
const profiles = tunnelProfileStore.profiles;
if (!sqliteSshOnlyTransport.value) return profiles;
return profiles.filter((profile) => profile.type === "ssh");
});
const selectedLayerProfileId = computed(() => selectedTransportLayer.value?.profile_id || "");
const selectedLayerProfile = computed(() => tunnelProfileStore.profileById(selectedLayerProfileId.value));
@@ -3102,10 +3106,63 @@ const zookeeperAuthScheme = computed<ZooKeeperAuthScheme>({
resetTestState();
},
});
const canUseTransportLayers = computed(() => form.value.db_type !== "sqlite" && form.value.db_type !== "access" && !isCloudflareD1Connection(form.value) && !isH2FileMode.value && !(form.value.db_type === "oracle" && form.value.oracle_connection_type === "tns"));
const shouldShowAgentDriverInstallHint = computed(() => showAgentDriverInstallHint(form.value.db_type, agentDrivers.value, form.value.driver_profile));
const canUseTransportLayers = computed(() => {
if (form.value.db_type === "access" || isCloudflareD1Connection(form.value) || isH2FileMode.value || (form.value.db_type === "oracle" && form.value.oracle_connection_type === "tns")) {
return false;
}
if (form.value.db_type === "sqlite") {
return isDesktop;
}
return true;
});
const sqliteSshOnlyTransport = computed(() => form.value.db_type === "sqlite");
const sqliteUsesSsh = computed(() => form.value.db_type === "sqlite" && connectionUsesSsh(form.value));
const sqliteWorkerPlacement = computed({
get: () => getUrlParam(form.value.url_params, "dbx_sqlite_worker") || "session",
set: (value: string) => {
const next = value === "session" ? "" : value;
form.value.url_params = setUrlParam(form.value.url_params, "dbx_sqlite_worker", next);
if (value !== "preplaced" && !getUrlParam(form.value.url_params, "dbx_sqlite_worker_path")) {
return;
}
if (value === "session") {
form.value.url_params = setUrlParam(form.value.url_params, "dbx_sqlite_worker_path", "");
}
},
});
const sqliteWorkerPath = computed({
get: () => getUrlParam(form.value.url_params, "dbx_sqlite_worker_path"),
set: (value: string) => {
form.value.url_params = setUrlParam(form.value.url_params, "dbx_sqlite_worker_path", value);
},
});
const sqliteWorkerPlacementOptions = [
{
value: "session",
labelKey: "connection.sqliteWorkerPlacementSession",
hintKey: "connection.sqliteWorkerPlacementSessionHint",
recommended: true,
},
{
value: "persist",
labelKey: "connection.sqliteWorkerPlacementPersist",
hintKey: "connection.sqliteWorkerPlacementPersistHint",
recommended: false,
},
{
value: "preplaced",
labelKey: "connection.sqliteWorkerPlacementPreplaced",
hintKey: "connection.sqliteWorkerPlacementPreplacedHint",
recommended: false,
},
] as const;
const shouldShowSqliteSshWorkerInstallHint = computed(() => form.value.db_type === "sqlite" && sqliteUsesSsh.value && showAgentDriverInstallHint("sqlite", agentDrivers.value, form.value.driver_profile, { ssh: true }));
const shouldShowAgentDriverInstallHint = computed(() => {
if (form.value.db_type === "sqlite" && sqliteUsesSsh.value) return false;
return showAgentDriverInstallHint(form.value.db_type, agentDrivers.value, form.value.driver_profile, { ssh: sqliteUsesSsh.value });
});
const agentDriverFocus = computed<DriverStoreFocus>(() => ({ target: "driver", driver: agentDriverInstallKey(form.value.db_type, form.value.driver_profile, { ssh: sqliteUsesSsh.value }) }));
const h2DriverMissing = computed(() => form.value.db_type === "h2" && isH2FileMode.value && agentDrivers.value.find((d) => d.db_type === "h2")?.installed !== true);
const agentDriverFocus = computed<DriverStoreFocus>(() => ({ target: "driver", driver: agentDriverInstallKey(form.value.db_type, form.value.driver_profile) }));
const canChooseVisibleNacosNamespaces = computed(() => form.value.db_type === "nacos");
const isNacosV3AdminPlane = computed(() => nacosImplementation.value === "nacos" && nacosVersionMode.value === "v3" && nacosApiPlane.value === "admin");
const isNacosV3ConsolePlane = computed(() => nacosImplementation.value === "nacos" && nacosVersionMode.value === "v3" && nacosApiPlane.value === "console");
@@ -5056,6 +5113,15 @@ watch(canUseTransportLayers, (value) => {
}
});
watch(sqliteSshOnlyTransport, (sshOnly) => {
if (!sshOnly) return;
const layers = form.value.transport_layers || [];
const next = layers.filter((layer) => layer.type === "ssh");
if (next.length === layers.length) return;
form.value.transport_layers = next;
selectedTransportLayerId.value = next[0]?.id || null;
});
watch(supportsTlsToggle, (value) => {
if (!value && configTab.value === "tls") {
configTab.value = "connection";
@@ -5077,6 +5143,7 @@ function addSshTunnel() {
}
function addProxyTunnel() {
if (sqliteSshOnlyTransport.value) return;
const next: TransportLayerConfig = { type: "proxy", ...defaultProxyTunnel() };
next.name = `Proxy ${transportLayers.value.length + 1}`;
form.value.transport_layers = [...transportLayers.value, next];
@@ -5085,6 +5152,7 @@ function addProxyTunnel() {
}
function addHttpTunnel() {
if (sqliteSshOnlyTransport.value) return;
const next: TransportLayerConfig = { type: "http_tunnel", ...defaultHttpTunnel() };
next.name = t("connection.httpTunnelDefaultName", { index: 1 });
form.value.transport_layers = [next, ...transportLayers.value];
@@ -5093,6 +5161,7 @@ function addHttpTunnel() {
}
function duplicateTransportLayer(layer: TransportLayerConfig) {
if (sqliteSshOnlyTransport.value && layer.type !== "ssh") return;
const next = normalizeTransportLayer({ ...layer, id: uuid(), name: layer.name ? `${layer.name} copy` : "" });
form.value.transport_layers = [...transportLayers.value, next];
selectedTransportLayerId.value = next.id;
@@ -5132,6 +5201,7 @@ function dropTransportLayer(targetId: string) {
function changeSelectedTransportLayerType(type: "ssh" | "proxy" | "http_tunnel") {
const selected = selectedTransportLayer.value;
if (!selected || selected.type === type) return;
if (sqliteSshOnlyTransport.value && type !== "ssh") return;
const replacement: TransportLayerConfig =
type === "proxy" ? { type: "proxy", ...defaultProxyTunnel(), id: selected.id, name: selected.name } : type === "http_tunnel" ? { type: "http_tunnel", ...defaultHttpTunnel(), id: selected.id, name: selected.name } : { type: "ssh", ...defaultSshTunnel(), id: selected.id, name: selected.name };
form.value.transport_layers = transportLayers.value.map((layer) => (layer.id === selected.id ? replacement : layer));
@@ -5154,6 +5224,9 @@ function updateSelectedSshAuthMethod(value: unknown) {
function validateTransportLayers(config: LegacyConnectionConfig) {
const layers = config.transport_layers || [];
if (config.db_type === "sqlite" && layers.some((layer) => layer.enabled !== false && layer.type !== "ssh")) {
throw new Error(t("connection.sqliteTransportSshOnly"));
}
layers.forEach((layer, index) => {
if (layer.enabled === false) return;
// Profile-referencing layers are stubs: the shared profile supplies the
@@ -6119,10 +6192,10 @@ function openExternalUrl(url: string) {
<Label :class="connectionLabelClass">{{ t("connection.filePath") }}</Label>
<div class="col-span-3 space-y-1">
<div class="flex items-center gap-1">
<Input v-model="form.host" class="flex-1" :placeholder="filePathPlaceholder" />
<Input v-model="form.host" class="flex-1" :placeholder="sqliteUsesSsh ? t('connection.sqliteRemotePathPlaceholder') : filePathPlaceholder" />
<Tooltip v-if="isDesktop">
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" @click="browseDbFilePath">
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" :disabled="sqliteUsesSsh" @click="browseDbFilePath">
<FolderOpen class="h-4 w-4" />
</Button>
</TooltipTrigger>
@@ -6138,23 +6211,54 @@ function openExternalUrl(url: string) {
</Tooltip>
<Tooltip v-if="isDesktop && form.db_type === 'sqlite'">
<TooltipTrigger as-child>
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" @click="createSqliteFilePath">
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" :disabled="sqliteUsesSsh" @click="createSqliteFilePath">
<FilePlus2 class="h-4 w-4" />
</Button>
</TooltipTrigger>
<TooltipContent>{{ t("connection.createSqliteFile") }}</TooltipContent>
</Tooltip>
</div>
<p v-if="supportsMemoryDatabasePath" class="text-xs text-muted-foreground">
<p v-if="sqliteUsesSsh" class="text-xs text-muted-foreground">
{{ t("connection.sqliteRemotePathHint") }}
</p>
<p v-else-if="supportsMemoryDatabasePath" class="text-xs text-muted-foreground">
{{ t("connection.memoryDatabasePathHint") }}
</p>
</div>
</div>
<div v-if="form.db_type === 'sqlite'" class="grid grid-cols-4 items-center gap-4">
<div v-if="form.db_type === 'sqlite' && sqliteUsesSsh" class="grid grid-cols-4 items-start gap-4">
<Label :class="connectionLabelTopClass">{{ t("connection.sqliteWorkerPlacement") }}</Label>
<div class="col-span-3 space-y-2">
<div class="flex min-h-9 flex-wrap items-center gap-x-5 gap-y-2">
<Tooltip v-for="option in sqliteWorkerPlacementOptions" :key="option.value" :delay-duration="0">
<TooltipTrigger as-child>
<label class="flex cursor-pointer items-center gap-1.5 text-sm">
<input type="radio" name="sqlite-worker-placement" class="h-3.5 w-3.5 accent-primary" :value="option.value" v-model="sqliteWorkerPlacement" />
<span>{{ t(option.labelKey) }}</span>
<Badge v-if="option.recommended" class="h-4 rounded-full px-1.5 text-[10px] leading-none">{{ t("connection.sqliteWorkerPlacementDefault") }}</Badge>
</label>
</TooltipTrigger>
<TooltipContent side="bottom" class="max-w-[18rem] flex-col items-start gap-1 py-2 text-left">
<div class="flex items-center gap-1.5 font-medium">
<span>{{ t(option.labelKey) }}</span>
<Badge v-if="option.recommended" class="h-4 rounded-full px-1.5 text-[10px] leading-none">{{ t("connection.sqliteWorkerPlacementDefault") }}</Badge>
</div>
<p class="text-[11px] leading-relaxed text-background/80">{{ t(option.hintKey) }}</p>
</TooltipContent>
</Tooltip>
</div>
<Input v-if="sqliteWorkerPlacement !== 'session'" v-model="sqliteWorkerPath" :placeholder="sqliteWorkerPlacement === 'persist' ? t('connection.sqliteWorkerPersistPathPlaceholder') : t('connection.sqliteWorkerPreplacedPathPlaceholder')" />
<p v-if="shouldShowSqliteSshWorkerInstallHint" class="text-xs text-muted-foreground">
{{ t("connection.driverInstallHintPrefix") }}<a class="underline cursor-pointer text-primary hover:text-primary/80" @click="emit('openDriverStore', agentDriverFocus)">{{ t("toolbar.driverManager") }}</a
>{{ t("connection.driverInstallHintSuffix") }}
</p>
</div>
</div>
<div v-if="form.db_type === 'sqlite' && !sqliteUsesSsh" class="grid grid-cols-4 items-center gap-4">
<Label :class="connectionLabelClass">{{ t("connection.sqliteCipherKey") }}</Label>
<PasswordInput v-model="form.password" class="col-span-3" :placeholder="t('connection.sqliteCipherKeyPlaceholder')" />
</div>
<div v-if="form.db_type === 'sqlite'" class="grid grid-cols-4 items-start gap-4">
<div v-if="form.db_type === 'sqlite' && !sqliteUsesSsh" class="grid grid-cols-4 items-start gap-4">
<Label :class="connectionLabelTopClass">{{ t("connection.sqliteExtensions") }}</Label>
<div class="col-span-3 space-y-1">
<div class="flex items-start gap-1">
@@ -8419,11 +8523,11 @@ function openExternalUrl(url: string) {
<Plus class="mr-1.5 h-3.5 w-3.5" />
{{ t("connection.sshHopAdd") }}
</Button>
<Button type="button" variant="outline" size="sm" @click="addProxyTunnel">
<Button v-if="!sqliteSshOnlyTransport" type="button" variant="outline" size="sm" @click="addProxyTunnel">
<Plus class="mr-1.5 h-3.5 w-3.5" />
{{ t("connection.proxy") }}
</Button>
<Button type="button" variant="outline" size="sm" @click="addHttpTunnel">
<Button v-if="!sqliteSshOnlyTransport" type="button" variant="outline" size="sm" @click="addHttpTunnel">
<Plus class="mr-1.5 h-3.5 w-3.5" />
{{ t("connection.httpTunnelAdd") }}
</Button>
@@ -8472,7 +8576,7 @@ function openExternalUrl(url: string) {
<span v-else class="text-red-500">{{ t("connection.tunnelProfileMissing") }}</span>
</div>
</div>
<div v-if="!selectedLayerProfileId" class="grid grid-cols-4 items-center gap-4">
<div v-if="!selectedLayerProfileId && !sqliteSshOnlyTransport" class="grid grid-cols-4 items-center gap-4">
<Label :class="connectionLabelSmallClass">Type</Label>
<Select :model-value="selectedTransportLayer.type" @update:model-value="(value: any) => changeSelectedTransportLayerType(value)">
<SelectTrigger class="col-span-3 h-9">
@@ -16,6 +16,7 @@ const assetIcons: Record<string, string> = {
cloudberry: "cloudberry",
opentenbase: "opentenbase",
sqlite: "sqlite",
"sqlite-worker": "sqlite",
rqlite: "rqlite.png",
turso: "turso.png",
cloudflare_d1: "cloudflare-d1",
@@ -424,6 +424,7 @@ const {
revealDatabaseFile,
canBackupSqliteDatabase,
backupSqliteDatabase,
restoreSqliteDatabase,
disconnectConnection,
connectionDisconnectMenuLabel,
canDisconnectConnection,
@@ -5007,11 +5008,20 @@ function buildConnectionSidebarMenu(context: SidebarMenuFactoryContext): boolean
});
}
if (canBackupSqliteDatabase.value) {
const config = activeNode.value.connectionId ? connectionStore.getConfig(activeNode.value.connectionId) : undefined;
const usesSsh = (config?.transport_layers || []).some((layer) => layer.enabled !== false && layer.type === "ssh");
items.push({
label: t("contextMenu.backupSqliteDatabase"),
action: backupSqliteDatabase,
icon: HardDriveDownload,
});
if (usesSsh) {
items.push({
label: t("contextMenu.restoreSqliteDatabase"),
action: restoreSqliteDatabase,
icon: HardDriveDownload,
});
}
}
items.push({ label: connectionDuplicateMenuLabel(), action: duplicateConnection, icon: CopyPlus });
items.push({ label: "", separator: true });
@@ -11,7 +11,7 @@ import { apiUrl } from "@/lib/common/webPath";
interface SshPromptRequest {
id: string;
kind: "HostKeyVerify" | "SecretInput";
kind: "HostKeyVerify" | "SecretInput" | "WorkerUploadConsent";
host: string;
port: number;
key_type?: string | null;
@@ -37,6 +37,7 @@ const { toast } = useToast();
const queue = ref<SshPromptRequest[]>([]);
const current = computed<SshPromptRequest | null>(() => queue.value[0] ?? null);
const isSecretPrompt = computed(() => current.value?.kind === "SecretInput");
const isWorkerUploadPrompt = computed(() => current.value?.kind === "WorkerUploadConsent");
const visible = ref(false);
const remember = ref(true);
@@ -247,31 +248,31 @@ function submitSecret() {
is a blocking prompt, so keep it above every other layer in the app (the
tallest today are the image preview at 80/81 and the sidebar overlays at
100). -->
<DialogContent class="sm:max-w-[460px]" overlay-class="z-[200]" portal-class="z-[200]" :show-close-button="false" @interact-outside.prevent @escape-key-down.prevent>
<DialogHeader>
<DialogContent class="flex max-h-[min(36rem,calc(var(--dbx-viewport-height)-2rem))] w-full max-w-[32rem] flex-col gap-4 overflow-hidden" overlay-class="z-[200]" portal-class="z-[200]" :show-close-button="false" @interact-outside.prevent @escape-key-down.prevent>
<DialogHeader class="shrink-0">
<DialogTitle>
{{ t(isSecretPrompt ? "connection.sshInteractiveTitle" : "connection.sshHostKeyVerifyTitle") }}
{{ t(isSecretPrompt ? "connection.sshInteractiveTitle" : isWorkerUploadPrompt ? "connection.sshWorkerUploadConsentTitle" : "connection.sshHostKeyVerifyTitle") }}
</DialogTitle>
<DialogDescription class="text-muted-foreground">
{{ t(isSecretPrompt ? "connection.sshInteractiveMessage" : "connection.sshHostKeyVerifyMessage", { host: current?.host ?? "", port: current?.port ?? "" }) }}
{{ t(isSecretPrompt ? "connection.sshInteractiveMessage" : isWorkerUploadPrompt ? "connection.sshWorkerUploadConsentMessage" : "connection.sshHostKeyVerifyMessage", { host: current?.host ?? "", port: current?.port ?? "" }) }}
</DialogDescription>
</DialogHeader>
<div v-if="current" class="space-y-3 py-1">
<div v-if="current.kind === 'HostKeyVerify'" class="rounded-md border border-border bg-muted/40 p-3 text-sm">
<div class="flex items-center justify-between gap-3">
<span class="text-muted-foreground">{{ t("connection.sshHostKeyVerifyKeyType") }}</span>
<span class="font-medium">{{ current.key_type || "—" }}</span>
<div v-if="current" class="min-h-0 flex-1 space-y-3 overflow-y-auto py-1">
<div v-if="current.kind === 'HostKeyVerify' || current.kind === 'WorkerUploadConsent'" class="space-y-3 rounded-md border border-border bg-muted/40 p-3 text-sm">
<div class="space-y-1">
<div class="text-muted-foreground">{{ current.kind === "WorkerUploadConsent" ? t("connection.sshWorkerUploadConsentDigest") : t("connection.sshHostKeyVerifyKeyType") }}</div>
<div class="break-all font-mono text-xs font-medium leading-5">{{ current.kind === "WorkerUploadConsent" ? current.fingerprint || "—" : current.key_type || "—" }}</div>
</div>
<div class="mt-2 flex items-start justify-between gap-3">
<span class="shrink-0 text-muted-foreground">{{ t("connection.sshHostKeyVerifyFingerprint") }}</span>
<span class="break-all text-right font-mono text-xs font-medium">{{ current.fingerprint || "—" }}</span>
<div class="space-y-1">
<div class="text-muted-foreground">{{ current.kind === "WorkerUploadConsent" ? t("connection.sshWorkerUploadConsentPath") : t("connection.sshHostKeyVerifyFingerprint") }}</div>
<div class="break-all font-mono text-xs font-medium leading-5">{{ current.kind === "WorkerUploadConsent" ? current.prompt || "—" : current.fingerprint || "—" }}</div>
</div>
</div>
<label v-if="current.kind === 'HostKeyVerify'" class="flex items-center gap-2 text-sm">
<label v-if="current.kind === 'HostKeyVerify' || current.kind === 'WorkerUploadConsent'" class="flex items-center gap-2 text-sm">
<input type="checkbox" v-model="remember" class="h-4 w-4 rounded border-border accent-primary" />
<span>{{ t("connection.sshHostKeyVerifyRemember") }}</span>
<span>{{ current.kind === "WorkerUploadConsent" ? t("connection.sshWorkerUploadConsentRemember") : t("connection.sshHostKeyVerifyRemember") }}</span>
</label>
<div v-else-if="current.kind === 'SecretInput'" class="space-y-2">
@@ -289,12 +290,12 @@ function submitSecret() {
</div>
</div>
<DialogFooter>
<DialogFooter class="shrink-0">
<Button variant="outline" :disabled="resolving" @click="reject">
{{ t(isSecretPrompt ? "connection.sshInteractiveCancel" : "connection.sshHostKeyVerifyReject") }}
{{ t(isSecretPrompt ? "connection.sshInteractiveCancel" : isWorkerUploadPrompt ? "connection.sshWorkerUploadConsentReject" : "connection.sshHostKeyVerifyReject") }}
</Button>
<Button v-if="current?.kind !== 'SecretInput'" :disabled="resolving" @click="accept">
{{ t("connection.sshHostKeyVerifyAccept") }}
{{ t(isWorkerUploadPrompt ? "connection.sshWorkerUploadConsentAccept" : "connection.sshHostKeyVerifyAccept") }}
</Button>
<Button v-else :disabled="resolving || !secretCode" @click="submitSecret">
{{ t("connection.sshInteractiveSubmit") }}
@@ -238,6 +238,34 @@ describe("SshHostKeyPromptDialog web bridge", () => {
expect(setSpy).toHaveBeenCalledTimes(2);
});
it("shows worker-upload consent buttons and wraps the digest and path", async () => {
await mountDialog();
const eventSource = MockEventSource.instances[0];
eventSource?.emit({
type: "prompt",
request: {
id: "worker-1",
kind: "WorkerUploadConsent",
host: "203.0.113.10",
port: 22,
fingerprint: "08ca4746e8fbf97038a93105d3ef023112e3f66bc097869401628c00acea7709",
prompt: "/home/testuser/.cache/dbx/sqlite-worker/session-ebd207de-8f26cd6e-08ca4746e8fbf97038a93105d3ef023112e3f66bc097869401628c00acea7709",
},
});
await nextTick();
expect(document.body.textContent).toContain("203.0.113.10:22");
expect(document.body.textContent).toContain("08ca4746e8fbf97038a93105d3ef023112e3f66bc097869401628c00acea7709");
expect(document.body.textContent).toContain("/home/testuser/.cache/dbx/sqlite-worker/");
expect(dialogSource).toContain("break-all");
expect(dialogSource).toContain("shrink-0");
const buttons = [...document.body.querySelectorAll("button")].map((button) => button.textContent?.trim());
expect(buttons).toContain("Cancel");
expect(buttons).toContain("Upload");
});
it("submits a keyboard-interactive TOTP challenge as a secret response", async () => {
await mountDialog();