mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
c6baebd514
* Support password in ssh deep links with ephemeral connect ssh://user:password@host URLs now connect directly using the URL credentials without saving the host to the vault, covering bastion one-time password flows. Password-less links keep the existing match-or-prefill behavior. Fixes #1890 Co-authored-by: Cursor <cursoragent@cursor.com> * Keep ephemeral deep-link hosts out of vault update paths Terminal-layer host updates (e.g. the SFTP follow-CWD toggle) map over the merged terminal host list, which could persist an ephemeral host and its plaintext password into the vault. Route terminal-layer host updates through a splitter that applies ephemeral entries to in-memory state only and forwards just the vault hosts to updateHosts. Co-authored-by: Cursor <cursoragent@cursor.com> * Exclude ephemeral deep-link sessions from session restore Sessions backed by an in-memory ephemeral host cannot survive a relaunch (the one-time password only lives in memory), so persisting them would leak the ephemeral host metadata into restore storage and restore a tab that can never reconnect. Mark ephemeral hosts and their sessions, and filter them out of the session-restore payload. Co-authored-by: Cursor <cursoragent@cursor.com> * Treat ephemeral hosts as unsaved in appearance classification The terminal theme/font panel and pane appearance resolution decided "saved vault host" via hostMap membership. Ephemeral deep-link hosts are now in that map, so theme/font changes were routed to the persisted-host updater and silently dropped. Classify via isSavedVaultHost (ephemeral flag aware) so those changes fall back to the session/global setting path as before. Co-authored-by: Cursor <cursoragent@cursor.com> * Reuse saved host settings for password deep links and keep ephemeral marker on clones Password deep links now run saved-host matching first: a uniquely matched vault host contributes its non-credential settings (proxy, jump chain, charset, group, ...) to the ephemeral host while the URL credentials override vault identities and key references. Session clones (split/copy/copy-to-new-window) now carry the ephemeralHost marker so cloned tabs stay excluded from session restore. Co-authored-by: Cursor <cursoragent@cursor.com> * Block group credential inheritance on password deep-link ephemeral hosts buildSshDeepLinkEphemeralHostFromSaved now takes the group-resolved effective host and clears group/identityFilePaths in addition to identity references, so a later resolveEffectiveHost pass cannot re-inherit group default credentials (identity, key, password) over the one-time URL password. Non-credential group defaults (proxy, jump chain, charset, ...) are preserved via the effective host. Co-authored-by: Cursor <cursoragent@cursor.com> * Route ephemeral-host font zoom through the per-session font-size path Ctrl+zoom on a non-workspace ephemeral deep-link session hit the saved-host update path, where the vault updater silently dropped the change (ephemeral ids are not in the persisted hosts array). Zoom and the theme panel font-size slider/reset now store the size on the session (rendered via applySessionFontSizeToHost) for ephemeral hosts, matching the workspace-pane behavior. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix ephemeral session font zoom routing * Prevent ephemeral deep-link sudo autofill --------- Co-authored-by: Cursor <cursoragent@cursor.com>
86 lines
2.1 KiB
TypeScript
86 lines
2.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import type { Host, TerminalSession } from "../../types";
|
|
import { resolveTerminalFontSizeUpdateTarget } from "./terminalFontSizeUpdate";
|
|
|
|
const host = (overrides: Partial<Host> = {}): Host => ({
|
|
id: "host-1",
|
|
label: "Host",
|
|
hostname: "example.com",
|
|
username: "alice",
|
|
group: "",
|
|
tags: [],
|
|
os: "linux",
|
|
protocol: "ssh",
|
|
...overrides,
|
|
});
|
|
|
|
const session = (overrides: Partial<TerminalSession> = {}): TerminalSession => ({
|
|
id: "session-1",
|
|
hostId: "host-1",
|
|
hostLabel: "Host",
|
|
hostname: "example.com",
|
|
username: "alice",
|
|
status: "connected",
|
|
protocol: "ssh",
|
|
...overrides,
|
|
});
|
|
|
|
test("ephemeral sessions keep font zoom on the session when the host is missing", () => {
|
|
assert.deepEqual(
|
|
resolveTerminalFontSizeUpdateTarget({
|
|
session: session({ ephemeralHost: true }),
|
|
sessionHost: host(),
|
|
rawHost: null,
|
|
}),
|
|
{ kind: "session" },
|
|
);
|
|
});
|
|
|
|
test("workspace sessions keep font zoom on the session", () => {
|
|
assert.deepEqual(
|
|
resolveTerminalFontSizeUpdateTarget({
|
|
session: session({ workspaceId: "workspace-1" }),
|
|
sessionHost: host(),
|
|
rawHost: host(),
|
|
}),
|
|
{ kind: "session" },
|
|
);
|
|
});
|
|
|
|
test("local sessions update the global font size", () => {
|
|
assert.deepEqual(
|
|
resolveTerminalFontSizeUpdateTarget({
|
|
session: session({ protocol: "local" }),
|
|
sessionHost: host({ id: "local-session-1", protocol: "local" }),
|
|
rawHost: null,
|
|
}),
|
|
{ kind: "global" },
|
|
);
|
|
});
|
|
|
|
test("saved remote hosts update the host override", () => {
|
|
const savedHost = host();
|
|
|
|
assert.deepEqual(
|
|
resolveTerminalFontSizeUpdateTarget({
|
|
session: session(),
|
|
sessionHost: savedHost,
|
|
rawHost: savedHost,
|
|
}),
|
|
{ kind: "host", host: savedHost },
|
|
);
|
|
});
|
|
|
|
test("in-memory ephemeral hosts keep font zoom on the session", () => {
|
|
assert.deepEqual(
|
|
resolveTerminalFontSizeUpdateTarget({
|
|
session: session(),
|
|
sessionHost: host({ ephemeral: true }),
|
|
rawHost: host({ ephemeral: true }),
|
|
}),
|
|
{ kind: "session" },
|
|
);
|
|
});
|