Skip to content

Commit df60c03

Browse files
fix: add ec2>security_group inbound_rule PrefixListIds field
1 parent 5957bdd commit df60c03

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/plugin/manager/ec2/security_group_manager.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ def create_cloud_service(self, region, options, secret_data, schema):
7070
)
7171
)
7272

73-
for _user_group_pairs in in_rule.get("UserIdGroupPairs", []):
73+
for _user_group_pair in in_rule.get("UserIdGroupPairs", []):
7474
in_rule_copy = copy.deepcopy(in_rule)
7575
inbound_rules.append(
7676
self.custom_security_group_inbound_rule_info(
7777
in_rule_copy,
78-
_user_group_pairs,
78+
_user_group_pair,
7979
"user_id_group_pairs",
8080
vulnerable_ports,
8181
)
@@ -126,6 +126,14 @@ def create_cloud_service(self, region, options, secret_data, schema):
126126
)
127127
)
128128

129+
for prefix_list_id in out_rule.get("PrefixListIds", []):
130+
out_rule_copy = copy.deepcopy(out_rule)
131+
outbound_rules.append(
132+
self.custom_security_group_rule_info(
133+
out_rule_copy, prefix_list_id, "prefix_list_ids"
134+
)
135+
)
136+
129137
match_instances = self.get_security_group_map_instances(
130138
raw, instances
131139
)

src/plugin/manager/ec2_server/security_group_manager.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ def get_security_group_info(self, security_group_ids, security_groups):
4141
for group_pair in inbound_rule.get("UserIdGroupPairs", []):
4242
sg_data.update(self.set_group_pairs_data(group_pair))
4343
sg.append(sg_data)
44+
for _ip_v6_range in inbound_rule.get("Ipv6Ranges", []):
45+
sg_data.update(self.set_group_pairs_data(_ip_v6_range))
46+
sg.append(sg_data)
47+
for prefix_list_id in inbound_rule.get("PrefixListIds", []):
48+
sg_data.update(self.set_group_pairs_data(prefix_list_id))
49+
sg.append(sg_data)
4450

4551
# OUTBOUND
4652
for outbound_rules in match_sg.get("IpPermissionsEgress", []):
@@ -51,6 +57,12 @@ def get_security_group_info(self, security_group_ids, security_groups):
5157
for group_pair in outbound_rules.get("UserIdGroupPairs", []):
5258
sg_data.update(self.set_group_pairs_data(group_pair))
5359
sg.append(sg_data)
60+
for _ip_v6_range in outbound_rules.get("Ipv6Ranges", []):
61+
sg_data.update(self.set_group_pairs_data(_ip_v6_range))
62+
sg.append(sg_data)
63+
for prefix_list_id in outbound_rules.get("PrefixListIds", []):
64+
sg_data.update(self.set_group_pairs_data(prefix_list_id))
65+
sg.append(sg_data)
5466
return sg
5567

5668
def set_sg_base_data(self, sg, direction, rule):

0 commit comments

Comments
 (0)