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>
76 lines
2.2 KiB
TypeScript
76 lines
2.2 KiB
TypeScript
import type { TerminalSession } from "../../domain/models";
|
|
|
|
export function canReuseTerminalConnection(session: TerminalSession): boolean {
|
|
return (
|
|
(session.protocol === "ssh" || session.protocol === undefined) &&
|
|
!session.moshEnabled &&
|
|
!session.etEnabled &&
|
|
session.status === "connected"
|
|
);
|
|
}
|
|
|
|
type CloneSessionOptions = {
|
|
id: string;
|
|
localShellType?: TerminalSession["shellType"];
|
|
workspaceId?: string;
|
|
};
|
|
|
|
function getClonedShellType(
|
|
session: TerminalSession,
|
|
localShellType?: TerminalSession["shellType"],
|
|
): TerminalSession["shellType"] {
|
|
return session.protocol === "local" ? localShellType : session.shellType;
|
|
}
|
|
|
|
function createTerminalSessionClone(
|
|
session: TerminalSession,
|
|
options: CloneSessionOptions,
|
|
): TerminalSession {
|
|
const clonedSession: TerminalSession = {
|
|
id: options.id,
|
|
hostId: session.hostId,
|
|
hostLabel: session.hostLabel,
|
|
hostname: session.hostname,
|
|
username: session.username,
|
|
status: "connecting",
|
|
protocol: session.protocol,
|
|
port: session.port,
|
|
moshEnabled: session.moshEnabled,
|
|
etEnabled: session.etEnabled,
|
|
shellType: getClonedShellType(session, options.localShellType),
|
|
charset: session.charset,
|
|
localShell: session.localShell,
|
|
localShellArgs: session.localShellArgs,
|
|
localShellName: session.localShellName,
|
|
localShellIcon: session.localShellIcon,
|
|
localStartDir: session.localStartDir,
|
|
fontSize: session.fontSize,
|
|
fontSizeOverride: session.fontSizeOverride,
|
|
...(session.ephemeralHost ? { ephemeralHost: true } : {}),
|
|
reuseConnectionFromSessionId: canReuseTerminalConnection(session) ? session.id : undefined,
|
|
};
|
|
|
|
if (options.workspaceId) {
|
|
clonedSession.workspaceId = options.workspaceId;
|
|
}
|
|
|
|
return clonedSession;
|
|
}
|
|
|
|
export function createSplitTerminalSessionClone(
|
|
session: TerminalSession,
|
|
options: CloneSessionOptions,
|
|
): TerminalSession {
|
|
return createTerminalSessionClone(session, options);
|
|
}
|
|
|
|
export function createCopiedTerminalSessionClone(
|
|
session: TerminalSession,
|
|
options: CloneSessionOptions,
|
|
): TerminalSession {
|
|
return {
|
|
...createTerminalSessionClone(session, options),
|
|
serialConfig: session.serialConfig,
|
|
};
|
|
}
|