From 490140ebda8dc32d04b9030c08eb67e0a40c6d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 22 Nov 2024 13:08:22 +0000 Subject: [PATCH] incusd/cluster: Validate cluster HTTPS address on join too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- cmd/incusd/api_cluster.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/incusd/api_cluster.go b/cmd/incusd/api_cluster.go index e1db42c3c0..d9cab71e20 100644 --- a/cmd/incusd/api_cluster.go +++ b/cmd/incusd/api_cluster.go @@ -430,11 +430,16 @@ func clusterPutJoin(d *Daemon, r *http.Request, req api.ClusterPut) response.Res return response.BadRequest(fmt.Errorf("This server is already clustered")) } - // The old pre 'clustering_join' join API approach is no longer supported. + // Validate erver address. if req.ServerAddress == "" { return response.BadRequest(fmt.Errorf("No server address provided for this member")) } + err := validate.IsListenAddress(true, false, false)(req.ServerAddress) + if err != nil { + return response.BadRequest(fmt.Errorf("Invalid server address %q: %w", err)) + } + localHTTPSAddress := s.LocalConfig.HTTPSAddress() var config *node.Config