Skip to content

Commit 4515dfa

Browse files
fix: fix vulnerable_ports optional logic to background
1 parent 98f3671 commit 4515dfa

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

src/plugin/main.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,5 @@ def _create_init_metadata():
314314
"inventory.Region",
315315
"inventory.ErrorResource",
316316
],
317-
"options_schema": {
318-
"required": ["vulnerable_ports"],
319-
"type": "object",
320-
"properties": {
321-
"vulnerable_ports": {
322-
"title": "Vulnerable Ports Option",
323-
"type": "string",
324-
"default": DEFAULT_VULNERABLE_PORTS,
325-
"description": "Ex) 22,8080,3306 (Default = 22,3306)",
326-
}
327-
},
328-
},
329317
}
330318
}

src/plugin/manager/ec2/security_group_manager.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def create_cloud_service(self, region, options, secret_data, schema):
3737
cloudtrail_resource_type = "AWS::EC2::SecurityGroup"
3838

3939
# If Port Filter Option Exist
40-
vulnerable_ports = options.get("vulnerable_ports", DEFAULT_VULNERABLE_PORTS)
40+
vulnerable_ports = options.get("vulnerable_ports")
4141

4242
# Get default VPC
4343
default_vpcs = self._get_default_vpc()
@@ -173,14 +173,15 @@ def custom_security_group_inbound_rule_info(self, raw_rule, remote, remote_type,
173173

174174
protocol_display = raw_rule.get("protocol_display")
175175

176-
ports = self._get_vulnerable_ports(protocol_display, raw_rule, vulnerable_ports)
176+
if vulnerable_ports:
177+
ports = self._get_vulnerable_ports(protocol_display, raw_rule, vulnerable_ports)
177178

178-
raw_rule.update(
179-
{
180-
"vulnerable_ports": ports,
181-
"detected_vulnerable_ports": True if ports else False
182-
}
183-
)
179+
raw_rule.update(
180+
{
181+
"vulnerable_ports": ports,
182+
"detected_vulnerable_ports": True if ports else False
183+
}
184+
)
184185

185186
return raw_rule
186187

0 commit comments

Comments
 (0)