question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WAFv2 AndStatement and OrStatement incorrect validation

See original GitHub issue

Hi guys,

https://github.com/cloudtools/troposphere/blob/f287fa8999ef2a5f5e301ba5c0af6421471e230b/troposphere/validators/wafv2.py#L32-L33

In the validator for WAFv2 statements, there is a check to see if the number of statements if exactly 2 when it should be looking to see if there are at least 2 statements given.

“You provide more than one Statement within the AndStatement.” Source

AWS requires there to be more than one statement, but does not restrict them to only pairs.

A small change in the logic of the if statement and the TypeError message is all that is needed.

Thank you

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
markpeekcommented, Apr 4, 2022

Fixed in Release 4.0.1

0reactions
MattJaccinocommented, Apr 1, 2022

Had to rework the pieces on our end around the creation of the resources, but definitely nice to have all of the features available now.

Not specific to WAFv2, but one thing that did strike me as odd was that resource objects can be successfully initialized without all of the required properties being given. I thought I remembered it erroring out in situations like that, or am I missing something. ?

I thought with a property defined as

class SomeProperty(AWSProperty):
    props: PropsDictType = {
        "Prop1": (TYPE, True),
        "Prop2": (TYPE, False),
    }

if you tried to initialize without defining Prop1, it would throw some kind of exception. It seems like you can initialize resource objects without including all of the required properties, or with none at all.

Was this always the case, or did something change? If not, could that potentially be a feature request?

Thank you man

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::WAFv2::WebACL OrStatement - AWS CloudFormation
A logical rule statement used to combine other rule statements with OR logic. You provide more than one Statement within the OrStatement ....
Read more >
A reference in your rule statement is not valid., field ... - GitHub
Terraform throws an error when trying to create it using the code block as above: Error: Error creating WAFv2 WebACL: WAFInvalidParameterException: Error reason ......
Read more >
Protecting Your Web Application Using AWS Managed Rules ...
... the new AWS WAF, explain how the rule writing works using JSON with the WAFv2 API, and how you can migrate easily...
Read more >
Changelog — troposphere 4.0.1 documentation - Read the Docs
Fix WAFv2 AndStatement and OrStatement validation (Fixes #2026) ... Fix copy/paste issue resulting in incorrect ECS validator assignment (Fixes #2000).
Read more >
woodonggyu/wafv2/aws - Terraform Registry
Inputs ; visibility_config, Defines and enables Amazon CloudWatch metrics and web request sample collection. object({...}) { cloudwatch_metrics_enabled = false
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found