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'], 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" /> + +
+ +