Class: SecurityGroupIngressPortRangeRule
- Defined in:
- lib/cfn-nag/custom_rules/SecurityGroupIngressPortRangeRule.rb
Instance Method Summary collapse
-
#audit_impl(cfn_model) ⇒ Object
This will behave slightly different than the legacy jq based rule which was targeted against inline ingress only.
- #rule_id ⇒ Object
- #rule_text ⇒ Object
- #rule_type ⇒ Object
Methods inherited from BaseRule
Instance Method Details
#audit_impl(cfn_model) ⇒ Object
This will behave slightly different than the legacy jq based rule which was targeted against inline ingress only
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cfn-nag/custom_rules/SecurityGroupIngressPortRangeRule.rb', line 23 def audit_impl(cfn_model) violating_security_groups = cfn_model.security_groups.select do |security_group| violating_ingresses = security_group.ingresses.select do |ingress| ingress.fromPort != ingress.toPort end !violating_ingresses.empty? end violating_ingresses = cfn_model.standalone_ingress.select do |standalone_ingress| standalone_ingress.fromPort != standalone_ingress.toPort end violating_security_groups.map(&:logical_resource_id) + violating_ingresses.map(&:logical_resource_id) end |
#rule_id ⇒ Object
16 17 18 |
# File 'lib/cfn-nag/custom_rules/SecurityGroupIngressPortRangeRule.rb', line 16 def rule_id 'W27' end |
#rule_text ⇒ Object
7 8 9 10 |
# File 'lib/cfn-nag/custom_rules/SecurityGroupIngressPortRangeRule.rb', line 7 def rule_text 'Security Groups found ingress with port range instead of just a single ' \ 'port' end |