From 7b299a12de854b099af21bfb89b9f298d4b3a0d5 Mon Sep 17 00:00:00 2001 From: Igor Vinokur Date: Mon, 9 Nov 2020 15:04:33 +0200 Subject: [PATCH] Add exact match to SSH key name validation regexp --- plugins/ssh-plugin/src/ssh-plugin-backend.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ssh-plugin/src/ssh-plugin-backend.ts b/plugins/ssh-plugin/src/ssh-plugin-backend.ts index 478b8c53e3..813cb56546 100644 --- a/plugins/ssh-plugin/src/ssh-plugin-backend.ts +++ b/plugins/ssh-plugin/src/ssh-plugin-backend.ts @@ -159,7 +159,7 @@ export async function start(): Promise { const RESTART_WARNING_MESSAGE = 'Che Git plugin can leverage the generated keys now. To make them available in all workspace containers please restart your workspace.'; const ENTER_KEY_NAME_OR_LEAVE_EMPTY_MESSAGE = 'Please provide a hostname (e.g. github.com) or leave empty to setup default name'; -const hostNamePattern = new RegExp('[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'); +const hostNamePattern = new RegExp('^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'); const getHostName = async (message?: string) => await theia.window.showInputBox({ placeHolder: message ? message : 'Please provide a hostname e.g. github.com',