fix(query): resolve false positive on ALB WAF integration with WAFv2#8004
Open
cx-prathmesh-borle wants to merge 1 commit intoCheckmarx:masterfrom
Open
fix(query): resolve false positive on ALB WAF integration with WAFv2#8004cx-prathmesh-borle wants to merge 1 commit intoCheckmarx:masterfrom
cx-prathmesh-borle wants to merge 1 commit intoCheckmarx:masterfrom
Conversation
704e619 to
69e8f7c
Compare
69e8f7c to
165420e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7405
Reason for Proposed Changes
105ba098(ALB Is Not Integrated With WAF) produces false positives on CloudFormation templates that use the newerAWS::WAFv2::WebACLAssociationresource type because the Rego logic only checks for the legacyAWS::WAFRegional::WebACLAssociationtype;associated_wafhelper function was hardcoded to only recognize the legacy type;!GetAttCloudFormation intrinsic function reference pattern, which KICS resolves to a string like"MyALB.LoadBalancerArn"instead of an object like{"Fn::GetAtt": ["MyALB", "LoadBalancerArn"]};!GetAtt MyALB.LoadBalancerArnsyntax were not recognized even when using WAFRegional;Proposed Changes
AWS::WAFRegional::WebACLAssociationrules inquery.regowith a type set and four rules covering all reference patterns:waf_association_types := {"AWS::WAFRegional::WebACLAssociation", "AWS::WAFv2::WebACLAssociation"}to recognize both WAF Classic and WAFv2;{"Ref": "ALBName"}pattern (JSON format with explicit Ref object);"ALBName"pattern (resolved!Refin YAML or direct string);{"Fn::GetAtt": ["ALBName", "Attr"]}pattern (JSON format with explicit GetAtt object);"ALBName.Attr"pattern (resolved!GetAttin YAML usingstartswithcheck);negative3.yaml- WAFv2 with!GetAttreference (the exact pattern from the issue report);negative4.json- WAFv2 withRefin JSON format;negative5.yaml- WAFv2 with!Ref(resolved to direct string);negative6.json- WAFv2 withFn::GetAttin JSON format;Note
aws_wafv2_web_acl_associationinwaf_resourceslist); Pulumi has no variant of this query;I submit this contribution under the Apache-2.0 license.