TypeScript
fix(ssh): ask for a password or verification code, not only a password (#20272)
Victor Vogelcc93dc10d235
diff --git a/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx b/apps/web/src/components/desktop/SshPasswordPromptDialog.tsxindex b7b995bc335..0d63558e896 100644--- a/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx+++ b/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx@@ -25,9 +25,9 @@ function formatRemainingSeconds(seconds: number): string {}function getPromptErrorMessage(error: unknown): string {- const message = error instanceof Error ? error.message : "SSH password prompt failed.";+ const message = error instanceof Error ? error.message : "SSH verification prompt failed.";return message.includes("expired") || message.includes("no longer pending")- ? "This SSH password prompt expired. Try connecting again."+ ? "This SSH verification prompt expired. Try connecting again.": message;}@@ -104,7 +104,7 @@ function ActiveSshPasswordPrompt({const remainingLabel =remainingSeconds === null ? null : formatRemainingSeconds(remainingSeconds);const visibleResponseError = isExpired- ? "This SSH password prompt expired. Try connecting again."+ ? "This SSH verification prompt expired. Try connecting again.": responseError;const respond = async (nextPassword: string | null) => {@@ -114,7 +114,7 @@ function ActiveSshPasswordPrompt({const requestId = request.requestId;if (nextPassword !== null && isExpired) {- setResponseError("This SSH password prompt expired. Try connecting again.");+ setResponseError("This SSH verification prompt expired. Try connecting again.");return;}@@ -158,10 +158,11 @@ function ActiveSshPasswordPrompt({><DialogPopup className="max-w-md" showCloseButton={false}><DialogHeader>- <DialogTitle>SSH Password Required</DialogTitle>+ <DialogTitle>SSH verification required</DialogTitle><DialogDescription>- T3 needs your SSH password to connect to <code>{target}</code>. The password is passed- to the local SSH process for this connection attempt and is not saved by T3 Code.+ Enter the password or verification code required by <code>{target}</code>. T3 Code+ passes your response to the local SSH process and keeps it in memory to reuse for this+ host. T3 Code does not write it to disk.</DialogDescription></DialogHeader><DialogPanel scrollFade={false}>@@ -202,7 +203,8 @@ function ActiveSshPasswordPrompt({<p className="text-sm text-destructive">{visibleResponseError}</p>) : (<p className="text-sm text-muted-foreground">- Use SSH keys to avoid repeated password prompts on new SSH sessions.+ SSH keys may replace a password, but your server can still require a verification+ code.</p>)}</form>diff --git a/packages/ssh/src/tunnel.ts b/packages/ssh/src/tunnel.tsindex c7be29a9ded..069a522f175 100644--- a/packages/ssh/src/tunnel.ts+++ b/packages/ssh/src/tunnel.ts@@ -1429,7 +1429,7 @@ const makeSshEnvironmentManager = Effect.fn("ssh/tunnel.SshEnvironmentManager.maattempt,destination: target.alias.trim() || target.hostname.trim(),username: target.username,- prompt: `Enter the SSH password for ${hostSpec}.`,+ prompt: `Enter the SSH password or verification code for ${hostSpec}.`,});if (password === null) {yield* Effect.logWarning("ssh.auth.passwordPrompt.cancelled", {