fix(CKV2_AWS_19): allow EIPs attached to Network Load Balancers to pass#7564
Open
AlexanderSanin wants to merge 1 commit into
Open
fix(CKV2_AWS_19): allow EIPs attached to Network Load Balancers to pass#7564AlexanderSanin wants to merge 1 commit into
AlexanderSanin wants to merge 1 commit into
Conversation
CKV2_AWS_19 was reporting a false positive for EIPs with `domain = "vpc"` that are used in the `subnet_mapping.allocation_id` of an `aws_lb` (Network Load Balancer). The check correctly verified VPC membership via the `domain` attribute, but the connection check only permitted aws_instance, aws_nat_gateway, aws_transfer_server, and aws_eip_association — not NLBs. Add `aws_lb` and `aws_alb` as valid connected resource types so that EIPs attached to Network Load Balancers (a legitimate use case) are no longer flagged as violations. Add a corresponding test case with an NLB `subnet_mapping` that references the EIP via `allocation_id`. Closes bridgecrewio#7532 Signed-off-by: Oleksandr Sanin <alexaaander.sanin@gmail.com>
Contributor
Author
|
Hey @yuvalmich @omriyoffe-panw @maxamel. Could you, please, have a look at this? |
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.
Summary
aws_eipresources withdomain = "vpc"when the EIP is used in thesubnet_mapping.allocation_idof anaws_lb(Network Load Balancer).vpc = trueordomain = "vpc"), but the connection check only allowedaws_instance,aws_nat_gateway,aws_transfer_server, andaws_eip_association— not NLBs.aws_lbandaws_albas valid connected resource types in the YAML definition so EIPs legitimately assigned to NLBs are no longer flagged.Closes #7532
Test plan
aws_eip.ok_eip_nlbtest resource intests/terraform/graph/checks/resources/EIPAllocatedToVPCAttachedEC2/main.tf— an EIP withdomain = "vpc"referenced by anaws_lbviasubnet_mapping.allocation_idexpected.yamlto includeaws_eip.ok_eip_nlbin thepasslisttest_EIPAllocatedToVPCAttachedEC2passes locally with the new test case