Skip to content
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,15 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# {fact rule=aws-missing-encryption-cdk@v1.0 defects=0}
import aws_cdk as cdk
from aws_cdk import aws_sqs as sqs


class Stack(cdk.Stack):

def missing_encryption_compliant(self):
# Compliant: encryption present
encrypted_queue = sqs.Queue(self, 'encrypted_queue',
encryption=sqs.QueueEncryption.KMS_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 rule=aws-missing-encryption-cdk@v1.0 defects=1}
import aws_cdk as cdk
from aws_cdk import aws_sqs as sqs


class Stack(cdk.Stack):

def missing_encryption_noncompliant(self):
# Noncompliant: missing encryption
unencrypted_queue = sqs.Queue(self, 'unencrypted_queue')
# {/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 rule=missing-authentication-for-critical-function-cdk@v1.0 defects=0}
import aws_cdk as cdk
from aws_cdk import aws_s3 as s3


class S3Stack(cdk.Stack):

def missing_authentication_compliant(self):
# Compliant: bucket is private
public_bucket = s3.Bucket(self, 'bucket')
# {/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 rule=missing-authentication-for-critical-function-cdk@v1.0 defects=1}
import aws_cdk as cdk
from aws_cdk import aws_s3 as s3


class S3Stack(cdk.Stack):

def missing_authentication_noncompliant(self):
# Noncompliant: bucket made public
public_bucket = s3.Bucket(self, 'bucket')
public_bucket.grant_public_access()
# {/fact}