Skip to content

Commit

Permalink
incusd/cluster: Validate cluster HTTPS address on join too
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Nov 22, 2024
1 parent d55c315 commit 490140e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/incusd/api_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Check failure on line 440 in cmd/incusd/api_cluster.go

View workflow job for this annotation

GitHub Actions / Code (oldstable)

printf: fmt.Errorf format %w reads arg #2, but call has 1 arg (govet)

Check failure on line 440 in cmd/incusd/api_cluster.go

View workflow job for this annotation

GitHub Actions / Code (stable)

printf: fmt.Errorf format %w reads arg #2, but call has 1 arg (govet)

Check failure on line 440 in cmd/incusd/api_cluster.go

View workflow job for this annotation

GitHub Actions / Code (tip)

printf: fmt.Errorf format %w reads arg #2, but call has 1 arg (govet)
}

localHTTPSAddress := s.LocalConfig.HTTPSAddress()

var config *node.Config
Expand Down

0 comments on commit 490140e

Please sign in to comment.