Skip to content

ec2: CloudFormation-Validate::W3687 false positive for ICMPv6 in security group rule #38422

Description

@Tietew

Describe the bug

CloudFormation-Validate::W3687 is reported when ec2.Port.allIcmpV6() is used in EC2 security group rules.

declare const securityGroup: ec2.SecurityGroup;
securityGroup.addIngressRule(ec2.Peer.anyIpv6(), ec2.Port.allIcmpV6());

WARNING FromPort: ['FromPort', 'ToPort'] are ignored when using 'IpProtocol' value 'icmpv6' (CloudFormation Validate)
... aws-cdk-lib.aws_ec2.CfnSecurityGroupIngress
Acknowledge with 'CloudFormation-Validate::W3687'

-1 should be allowed at FromPort and ToPort for ICMPv6.

https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-securitygroupingress.html#cfn-ec2-securitygroupingress-fromport

A value of -1 indicates all ICMP/ICMPv6 types.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

No warnings are reported.

Current Behavior

See description above.

Reproduction Steps

See description above.

Possible Solution

No response

Additional Information/Context

We can safely acknowledge this warning.

AWS CDK Library version (aws-cdk-lib)

2.262.1

AWS CDK CLI version

2.1133.0 (build 712d792)

Node.js Version

v24.18.0

OS

Linux

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudbugThis issue is a bug.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions