From 8533ef501d8d90774b9f98726a5db1e5f870f9c8 Mon Sep 17 00:00:00 2001 From: Hugo Blom <6117705+huxcrux@users.noreply.github.com> Date: Fri, 1 Mar 2024 14:02:14 +0100 Subject: [PATCH] Make sure that additional ports security groups are dynamic and cannot go out of range --- pkg/cloud/services/networking/securitygroups_rules.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/cloud/services/networking/securitygroups_rules.go b/pkg/cloud/services/networking/securitygroups_rules.go index e7dcdd1d3b..5bea83c1a4 100644 --- a/pkg/cloud/services/networking/securitygroups_rules.go +++ b/pkg/cloud/services/networking/securitygroups_rules.go @@ -223,11 +223,9 @@ func getSGControlPlaneAdditionalPorts(ports []int) []resolvedSecurityGroupRuleSp Protocol: "tcp", }, } - for _, p := range ports { - r[0].PortRangeMin = p - r[0].PortRangeMax = p - r[1].PortRangeMin = p - r[1].PortRangeMax = p + for i, p := range ports { + r[i].PortRangeMin = p + r[i].PortRangeMax = p controlPlaneRules = append(controlPlaneRules, r...) } return controlPlaneRules