From 8d34c45ea3b2154cefbb07bcc9a31a476a6c83da Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Mon, 18 Dec 2023 15:26:36 +0300 Subject: [PATCH 1/2] added check of `host` value during daemon registration --- lib/Service/DaemonConfigService.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Service/DaemonConfigService.php b/lib/Service/DaemonConfigService.php index 18ed8e7c..3c3ffd76 100644 --- a/lib/Service/DaemonConfigService.php +++ b/lib/Service/DaemonConfigService.php @@ -31,6 +31,14 @@ public function __construct( } public function registerDaemonConfig(array $params): ?DaemonConfig { + $bad_patterns = ['http', 'https', 'tcp', 'udp', 'ssh']; + $docker_host = (string)$params['host']; + foreach ($bad_patterns as $bad_pattern) { + if (str_starts_with($docker_host, $bad_pattern . '://')) { + $this->logger->error('Failed to register daemon configuration. `host` must not include a protocol.'); + return null; + } + } try { $daemonConfig = $this->mapper->insert(new DaemonConfig([ 'name' => $params['name'], From bf38c88ced740f571adb66234b0f42787a924e2d Mon Sep 17 00:00:00 2001 From: Andrey Borysenko Date: Mon, 18 Dec 2023 15:20:07 +0200 Subject: [PATCH 2/2] allow editing nextcloud_url, added helper text Signed-off-by: Andrey Borysenko --- .../RegisterDaemonConfigModal.vue | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/DaemonConfig/RegisterDaemonConfigModal.vue b/src/components/DaemonConfig/RegisterDaemonConfigModal.vue index fa3a00fb..687df8f4 100644 --- a/src/components/DaemonConfig/RegisterDaemonConfigModal.vue +++ b/src/components/DaemonConfig/RegisterDaemonConfigModal.vue @@ -52,8 +52,17 @@ + :placeholder="t('app_api', 'Daemon host (e.g. /var/run/docker.sock, proxy-domain.com:2375)')" + :aria-label="t('app_api', 'Daemon host (e.g. /var/run/docker.sock, proxy-domain.com:2375)')" + :helper-text="daemonHostHelperText" /> + +
+ +