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

Add compliant and non-compliant examples for s3-partial-encrypt-cdk, exposure-of-sensitive-information-cdk #97

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# {fact [email protected] defects=0}
import aws_cdk as cdk
from aws_cdk.aws_ec2 import CfnSecurityGroupIngress


class SelectivePorts(cdk.Stack):

def exposure_of_sensitive_information_compliant(self):
# Compliant: 0.0.0.0/0 range is not used
CfnSecurityGroupIngress(cdk.Stack, 'rIngress',
ip_protocol='tcp',
cidr_ip='1.2.3.4/32')

# {/fact}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# {fact [email protected] defects=1}
import aws_cdk as cdk
from aws_cdk.aws_ec2 import CfnSecurityGroupIngress


class SelectivePorts(cdk.Stack):

def exposure_of_sensitive_information_noncompliant(self):
# Noncompliant: 0.0.0.0/0 range is used
CfnSecurityGroupIngress(cdk.Stack, 'rIngress',
ip_protocol='tcp',
cidr_ip='0.0.0.0/0')

# {/fact}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# {fact [email protected] defects=0}
import aws_cdk as cdk
from aws_cdk import aws_s3 as s3


class S3PartialEncrypt(cdk.Stack):

def s3_partial_encrypt_compliant(self):
# Compliant: S3_MANAGED encryption specified
bucket = s3.Bucket(self, 's3-bucket',
encryption=s3.BucketEncryption.S3_MANAGED)
# {/fact}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# {fact [email protected] defects=1}
import aws_cdk as cdk
from aws_cdk import aws_s3 as s3


class S3PartialEncrypt(cdk.Stack):

def s3_partial_encrypt_noncompliant(self):
# Noncompliant: No encryption specified
bucket = s3.Bucket(self, 's3-bucket-bad')
# {/fact}
Loading