[plasma/ksshaskpass] /: Handle when unknown host prompt has no period after the finger print
Kai Uwe Broulik <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 70d4786168e02f7e12bf0b7d5e28fd303ab73037 by Kai Uwe Broulik.
Committed on 17/08/2026 at 14:09.
Pushed by broulik into branch 'master'.
Handle when unknown host prompt has no period after the finger print
I have seen this in the wild.
M +17 -0 autotests/tst_prompt.cpp
M +1 -1 src/prompt.cpp
https://invent.kde.org/plasma/ksshaskpass/-/commit/70d4786168e02f7e12bf0b7d5e28fd303ab73037
diff --git a/autotests/tst_prompt.cpp b/autotests/tst_prompt.cpp
index b14c8b3..ad394c2 100644
--- a/autotests/tst_prompt.cpp
+++ b/autotests/tst_prompt.cpp
@@ -129,6 +129,14 @@ void PromptTest::testPrompt_data()
"Are you sure you want to continue connecting (yes/no/[fingerprint])? ")
<< QString() << DisplayType::UnknownSshHost << true;
+ QTest::newRow("unknown-host-period") << PromptType::Entry
+ << QStringLiteral(
+ "The authenticity of host 'invent.kde.org (1.2.3.4)' can't be established.\n"
+ "ED25519 key fingerprint is SHA256:1234567890abcdef\n"
+ "This key is not known by any other names.\n"
+ "Are you sure you want to continue connecting (yes/no/[fingerprint])? ")
+ << QString() << DisplayType::UnknownSshHost << true;
+
QTest::newRow("unknown-host-other-name") << PromptType::Entry
<< QStringLiteral(
"The authenticity of host 'invent.kde.org (1.2.3.4)' can't be established.\n"
@@ -138,6 +146,15 @@ void PromptTest::testPrompt_data()
"Are you sure you want to continue connecting (yes/no/[fingerprint])? ")
<< QString() << DisplayType::UnknownSshHost << true;
+ QTest::newRow("unknown-host-other-name-period") << PromptType::Entry
+ << QStringLiteral(
+ "The authenticity of host 'invent.kde.org (1.2.3.4)' can't be established.\n"
+ "ED25519 key fingerprint is SHA256:1234567890abcdef\n"
+ "This host key is known by the following other names/addresses:\n"
+ " ~/.ssh/known_hosts:14: [hashed name]\n"
+ "Are you sure you want to continue connecting (yes/no/[fingerprint])? ")
+ << QString() << DisplayType::UnknownSshHost << true;
+
QTest::newRow("unknown-host-colon") << PromptType::Entry
<< QStringLiteral(
"The authenticity of host 'invent.kde.org (1.2.3.4)' can't be established.\n"
diff --git a/src/prompt.cpp b/src/prompt.cpp
index b78e817..e042cca 100644
--- a/src/prompt.cpp
+++ b/src/prompt.cpp
@@ -208,7 +208,7 @@ void parsePrompt(PromptType promptType, const QString &prompt, QString &identifi
// Case: unknown SSH host
match = QRegularExpression(QStringLiteral("^The authenticity of host '([^']+)(?: \\(([^)]+)\\))?' can't be established\\.\n"
- "([A-Z0-9_-]+) key fingerprint is:? ([A-Za-z0-9:+/=]+)\\.\n"
+ "([A-Z0-9_-]+) key fingerprint is:? ([A-Za-z0-9:+/=]+)\\.?\n"
"(?:.*\n)*"
"Are you sure you want to continue connecting \\(yes/no/\\[fingerprint\\]\\)\\?\\s*$"))
.match(prompt);