Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CKV_AWS_342 Ensure WAF rule has any actions should not consider a managed rule group #5318

Closed
ziggythehamster opened this issue Jul 10, 2023 · 1 comment · Fixed by #5322
Closed
Labels
checks Check additions or changes terraform

Comments

@ziggythehamster
Copy link
Contributor

ziggythehamster commented Jul 10, 2023

Describe the issue

CKV_AWS_342 currently will flag a WAFv2 WebACL that uses only managed rule groups. Managed rule groups have AWS-defined behavior regarding the actions that are taken (and some, like bot control, are not possible to express with the rule syntax), so you don't specify an action unless you want to override it, and the only override options are to count without blocking or to do nothing at all. This means it is not possible to actually satisfy this Checkov check while ensuring you are blocking traffic as intended.

This check should apply in situations where you're not specifying a managed rule group.

Examples

This currently fails but should pass:

resource "aws_wafv2_web_acl" "this" {
  name          = var.name
  description   = "Managed by Terraform, do not edit in the console"
  scope         = "REGIONAL"
  token_domains = [var.dns.fqdn, aws_lb.this.dns_name]

  default_action {
    allow {}
  }

  rule {
    name     = "aws-managed-rules-common"
    priority = 1

    statement {
      managed_rule_group_statement {
        name        = "AWSManagedRulesCommonRuleSet"
        vendor_name = "AWS"
      }
    }
  }
}

Version (please complete the following information):

2.3.317

Additional information:

It may also be that managed rules themselves are usable in a statement and thus should also be ignored for the purposes of checking that rules have actions, but I'm not sure what that looks like.

@ziggythehamster ziggythehamster added the checks Check additions or changes label Jul 10, 2023
@JamesWoolfenden
Copy link
Contributor

Quite right Ziggy. Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checks Check additions or changes terraform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants