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

aws-cdk-lib/aws-wafv2: CfnWebACL and Cloudformation properties not matching #23679

Closed
phyllis-noester opened this issue Jan 13, 2023 · 8 comments
Labels
@aws-cdk/aws-wafregional Related to AWS WAF Regional

Comments

@phyllis-noester
Copy link

Describe the bug

When we create a CfnWebACL with the rule specified below, we get the following Cloudformation error:

Properties validation failed for resource prodPrivateFirewall with message:
#/Rules/1/Statement/ByteMatchStatement/FieldToMatch/SingleHeader: required key [Name] not found
#/Rules/1/Statement/ByteMatchStatement/FieldToMatch/SingleHeader: extraneous key [name] is not permitted

When trying to change it to Name as suggested, Typescript no longer compiles

Expected Behavior

CfnWebACL allows a Statement/ByteMatchStatement/FieldToMatch rule with a Name property.

Current Behavior

CDK expects the property name, while Cloudfront expects the property Name.

Reproduction Steps

Create the CfnWebACL with the following rule

const rule: CfnWebACL.RuleProperty = {
      action: { block: {} },
      name: 'rule-name',
      priority: ,
      statement: {
        byteMatchStatement: {
          fieldToMatch: {
            singleHeader: { name: 'Host' },
          },
          positionalConstraint: 'CONTAINS',
          searchString: 'some-string',
          textTransformations: [
            {
              priority: 0,
              type: 'NONE',
            },
          ],
        },
      },
      visibilityConfig: {
        cloudWatchMetricsEnabled: true,
        metricName: 'metric-name',
        sampledRequestsEnabled: true,
      },
    };

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.56.0

Framework Version

No response

Node.js Version

16

OS

macOS

Language

Typescript

Language Version

No response

Other information

No response

@phyllis-noester phyllis-noester added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 13, 2023
@github-actions github-actions bot added the @aws-cdk/aws-wafregional Related to AWS WAF Regional label Jan 13, 2023
@peterwoodworth
Copy link
Contributor

We fixed some issues related to Cfn resources since the version you're reporting this on. Could you please update versions to most recent? If that still doesn't work, could you post the full reproduction of creating this resource so that I can easily copy+paste? Thanks

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jan 14, 2023
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jan 16, 2023
@eloymg
Copy link

eloymg commented Jan 18, 2023

similar #23709

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Jan 18, 2023
@automartin5000
Copy link

automartin5000 commented Jan 24, 2023

@peterwoodworth I just updated to 2.61.1 and am still seeing #23709

@peterwoodworth
Copy link
Contributor

Sorry for not following up on this quickly. This behavior is actually a result of the changes I was describing earlier - fieldToMatch is one of the affected typings that were changed, and going forward it should be defined as any rather than being strongly typed, with explicitly set casing on the property names.

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed bug This issue is a bug. labels Feb 16, 2023
@peterwoodworth peterwoodworth removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 16, 2023
@automartin5000
Copy link

Sorry for not following up on this quickly. This behavior is actually a result of the changes I was describing earlier - fieldToMatch is one of the affected typings that were changed, and going forward it should be defined as any rather than being strongly typed, with explicitly set casing on the property names.

Ok, yeah that's what I had actually done to work around it, didn't realize that was the recommended approach. Do you know why that was changed instead of using a defined type?

@peterwoodworth
Copy link
Contributor

As mentioned above, this was intentional.

This occurred because the cfnspec caused a breaking change that changed it from being any type to being strongly typed. Sorry for any inconvenience, we're looking into making sure this doesn't happen again.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-wafregional Related to AWS WAF Regional
Projects
None yet
Development

No branches or pull requests

4 participants