cfn-guard 3.2.0

AWS CloudFormation Guard is an open-source general-purpose policy-as-code evaluation tool. It provides developers with a simple-to-use, yet powerful and expressive domain-specific language (DSL) to define policies and enables developers to validate JSON- or YAML- formatted structured data with those policies.
Documentation
# This rule will return 
# 1) FAIL if any IAM policy has a wildcard action
# 2) PASS if there are no IAM policies or IAM policies have no wildcard actions
#
rule assert_no_wildcard_actions {
  Roles[*] empty or
  Roles[*] {
      # if there are no policies - PASS
      Policies[*] empty or
      Policies[*].Policy.Statement[*] {
          Action[*] != '*'
      }
  }

  # if there are no users - PASS
  Users[*] empty or
  Users[*] {
      # if there are no policies - PASS
      Policies[*] empty or
      Policies[*].Policy.Statement[*] {
          Action[*] != '*'
      }
  }

  # if there are no groups - PASS
  Groups[*] empty or
  Groups[*] {
      # if there are no policies - PASS
      Policies[*] empty or
      Policies[*].Policy.Statement[*] {
          Action[*] != '*'
      }
  }

  # if there are no resources - PASS
  Resources[*] empty or
  Resources[*] {
      # resources only have a single policy
      Policy.Policy.Statement[*] {
          Action[*] != '*'
      }
  }

  # if there are no permission sets - PASS
  PermissionSets[*] empty or
  PermissionSets[*] {
      # if there are no policies - PASS
      Policies[*] empty or
      Policies[*].Policy.Statement[*] {
          Action[*] != '*'
      }
  }

  # if there are no orphaned policies - PASS
  OrphanedPolicies[*] empty or
  OrphanedPolicies[*] {
      # orphaned policies have direct policy elements, no need to traverse to Policies[*]
      Policy.Statement[*] {
          Action[*] != '*'
      }
  }
}