Skip to content

Commit

Permalink
fix PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gruebel committed Jul 12, 2023
1 parent 085136c commit b38795d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions checkov/terraform/checks/resource/aws/WAFRuleHasAnyActions.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
from __future__ import annotations

from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck


class WAFRuleHasAnyActions(BaseResourceCheck):
def __init__(self):
def __init__(self) -> None:
name = "Ensure WAF rule has any actions"
id = "CKV_AWS_342"
supported_resources = ('aws_waf_web_acl', 'aws_wafregional_web_acl', 'aws_wafv2_web_acl',
'aws_wafv2_rule_group', 'aws_wafregional_rule_group', 'aws_waf_rule_group')
categories = (CheckCategories.APPLICATION_SECURITY,)
super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)

def scan_resource_conf(self, conf):
def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:
rules = None
if conf.get("rule") and isinstance(conf["rule"], list):
rules = conf["rule"]
Expand All @@ -34,9 +36,10 @@ def scan_resource_conf(self, conf):
for statement in statements:
if statement.get('managed_rule_group_statement'):
passing = True
if passing:
continue
return CheckResult.FAILED

if not passing:
return CheckResult.FAILED

return CheckResult.PASSED

return CheckResult.UNKNOWN
Expand Down

0 comments on commit b38795d

Please sign in to comment.