Project: KICS (Provisioning / Security & Compliance)
File: 5e6c9c68-8a82-408e-8749-ddad78cbb9c5.md

title: Security Group Rule Without Description hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 5e6c9c68-8a82-408e-8749-ddad78cbb9c5 Query name: Security Group Rule Without Description Platform: CloudFormation Severity: <span style="color:#5bc0de">Info</span> Category: Best Practices URL: It's considered a best practice for AWS Security Group to have a description<br> ```yaml title="Positive test num. 1 - yaml file" hl_lines="33 4 7 12 19" Resources: InstanceSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: VpcId: Ref: myVPC SecurityGroupIngress: IpProtocol: tcp FromPort: 80 ToPort: 80 CidrIp: 0.0.0.0/0 SecurityGroupEgress: IpProtocol: tcp FromPort: 80 ToPort: 80 CidrIp: 0.0.0.0/0 OutboundRule: Type: AWS::EC2::SecurityGroupEgress Properties: IpProtocol: tcp FromPort: 0 ToPort: 65535 DestinationSecurityGroupId: Fn::GetAtt: TargetSG GroupId GroupId: Fn::GetAtt: SourceSG GroupId InboundRule: Type: AWS::EC2::SecurityGroupIngress Properties: IpProtocol: tcp FromPort: 0 ToPort: 65535 SourceSecurityGroupId: Fn::GetAtt: SourceSG GroupId GroupId: Fn::GetAtt: TargetSG GroupId ``` ```json title="Positive test num. 2 - json file" hl_lines="5 45 46 54 25" { "Resources": { "OutboundRule": { "Type": "AWS::EC2::SecurityGroupEgress", "Properties": { "IpProtocol": "tcp", "FromPort": 0, "ToPort": 65535, "DestinationSecurityGroupId": { "Fn::GetAtt": [ "TargetSG", "GroupId" ] }, "GroupId": { "Fn::GetAtt": [ "SourceSG", "GroupId" ] } } }, "InboundRule": { "Type": "AWS::EC2::SecurityGroupIngress", "Properties": { "SourceSecurityGroupId": { "Fn::GetAtt": [ "SourceSG", "GroupId" ] }, "GroupId": { "Fn::GetAtt": [ "TargetSG", "GroupId" ] }, "IpProtocol": "tcp", "FromPort": 0, "ToPort": 65535 } }, "InstanceSecurityGroup": { "Type": "AWS::EC2::SecurityGroup", "Properties": { "SecurityGroupIngress": [ { "IpProtocol": "tcp", "FromPort": 80, "ToPort": 80, "CidrIp": "0.0.0.0/0" } ], "SecurityGroupEgress": [ { "CidrIp": "0.0.0.0/0", "IpProtocol": "tcp", "FromPort": 80, "ToPort": 80 } ], "VpcId": { "Ref": "myVPC" } } } } } ``` ```yaml title="Negative test num. 1 - yaml file" Resources: InstanceSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: Allow http to client host VpcId: Ref: myVPC SecurityGroupIngress: IpProtocol: tcp Description: TCP FromPort: 80 ToPort: 80 CidrIp: 0.0.0.0/0 SecurityGroupEgress: IpProtocol: tcp Description: TCP FromPort: 80 ToPort: 80 CidrIp: 0.0.0.0/0 OutboundRule: Type: AWS::EC2::SecurityGroupEgress Properties: Description: TCP IpProtocol: tcp FromPort: 0 ToPort: 65535 DestinationSecurityGroupId: Fn::GetAtt: TargetSG GroupId GroupId: Fn::GetAtt: SourceSG GroupId InboundRule: Type: AWS::EC2::SecurityGroupIngress Properties: Description: TCP IpProtocol: tcp FromPort: 0 ToPort: 65535 SourceSecurityGroupId: Fn::GetAtt: SourceSG GroupId GroupId: Fn::GetAtt: TargetSG GroupId ``` ```json title="Negative test num. 2 - json file" { "Resources": { "InstanceSecurityGroup": { "Type": "AWS::EC2::SecurityGroup", "Properties": { "GroupDescription": "Allow http to client host", "VpcId": { "Ref": "myVPC" }, "SecurityGroupIngress": [ { "IpProtocol": "tcp", "Description": "TCP", "FromPort": 80, "ToPort": 80, "CidrIp": "0.0.0.0/0" } ], "SecurityGroupEgress": [ { "FromPort": 80, "ToPort": 80, "CidrIp": "0.0.0.0/0", "IpProtocol": "tcp", "Description": "TCP" } ] } }, "OutboundRule": { "Type": "AWS::EC2::SecurityGroupEgress", "Properties": { "GroupId": { "Fn::GetAtt": [ "SourceSG", "GroupId" ] }, "Description": "TCP", "IpProtocol": "tcp", "FromPort": 0, "ToPort": 65535, "DestinationSecurityGroupId": { "Fn::GetAtt": [ "TargetSG", "GroupId" ] } } }, "InboundRule": { "Type": "AWS::EC2::SecurityGroupIngress", "Properties": { "Description": "TCP", "IpProtocol": "tcp", "FromPort": 0, "ToPort": 65535, "SourceSecurityGroupId": { "Fn::GetAtt": [ "SourceSG", "GroupId" ] }, "GroupId": { "Fn::GetAtt": [ "TargetSG", "GroupId" ] } } } } } ```