Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

fix issue 1038 #1109

Merged
merged 1 commit into from
Sep 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions security_monkey/auditors/gcp/gce/firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ def _port_range_exists(self, allowed_list, error_cat='ALLOWED'):
Check to see if a port range exists in the allowed field.
"""
errors = []
for allowed in allowed_list:
ports = allowed.get('ports', None)
if ports:
for port in ports:
if str(port).find('-') > -1:
ae = make_audit_issue(
error_cat, 'EXISTS', 'PORTRANGE')
ae.notes = '%s:%s' % (allowed['IPProtocol'], port)
errors.append(ae)
if allowed_list:
for allowed in allowed_list:
ports = allowed.get('ports', None)
if ports:
for port in ports:
if str(port).find('-') > -1:
ae = make_audit_issue(
error_cat, 'EXISTS', 'PORTRANGE')
ae.notes = '%s:%s' % (allowed['IPProtocol'], port)
errors.append(ae)
return errors

def _target_tags_valid(self, target_tags, error_cat='TARGET_TAGS'):
Expand Down