Skip to main content

cdk-ecr-asset-scanner

Project description

CDK ECR Asset Scanner

The CDK ECR Asset Scanner is a custom L3 ScannedDockerImageAsset construct that builds and uploads your container image assets to ECR. After pushing, it will return the vulnerability report status in a Stack Output. In that way, it gives crucial and important security related information directly back to the engineer working with the stack. It aims to improve security insight while working with AWS CDK.

As stated before, ScannedDockerImageAsset is a custom L3 construct in the AWS Construct Library that combines the following L2 Constructs:

  • DockerImageAsset
  • A Custom Resource backed by a Lambda function
  • Stack outputs

Because it just combines existing Constructs, this means the ScannedDockerImageAsset is a very stable L3 construct, not deemed experimental.

Terminal

USAGE

Run npm i cdk-ecr-asset-scanner.

Just add the ScannedDockerImageAsset to your imports, and use it exactly like you would a normal DockerImageAsset. It will do all the heavy lifting under the hood by itself. Make sure cdk peer dependencies are correct as usual, but npm will point those out (> 1.118.0 cdk versions)

Example (ts):

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk_ecr_asset_scanner import ScannedDockerImageAsset
import path as path

env = {
    "region": process.env.CDK_DEFAULT_REGION,
    "account": process.env.CDK_DEFAULT_ACCOUNT
}

app = cdk.App()

class TestStack(cdk.Stack):
    def __init__(self, scope, id, props=None):
        super().__init__(scope, id, props)

        # Image without scan
        # const image3 = new DockerImageAsset(this, "zzz", {
        #   directory: path.join(__dirname, "../src/"),
        # });

        # Image with scan
        image = ScannedDockerImageAsset(self, "zzz",
            directory=path.join(__dirname, "../src/")
        )
        image3 = ecs.ContainerImage.from_docker_image_asset(image)

        task_definition = ecs.FargateTaskDefinition(self, "test-task-definition",
            memory_limit_mi_b=2048,
            cpu=1024
        )
        task_definition.add_container("container_example_three",
            image=image3,
            environment={
                "TEST_VAR": "THREE"
            },
            logging=ecs.AwsLogDriver(
                stream_prefix="three"
            )
        )
TestStack(app, "hh-stack", env=env)

Availability

  • Typescript / JS
  • Python

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk-ecr-asset-scanner-0.0.8.tar.gz (74.1 kB view details)

Uploaded Source

Built Distribution

cdk_ecr_asset_scanner-0.0.8-py3-none-any.whl (73.1 kB view details)

Uploaded Python 3

File details

Details for the file cdk-ecr-asset-scanner-0.0.8.tar.gz.

File metadata

  • Download URL: cdk-ecr-asset-scanner-0.0.8.tar.gz
  • Upload date:
  • Size: 74.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10

File hashes

Hashes for cdk-ecr-asset-scanner-0.0.8.tar.gz
Algorithm Hash digest
SHA256 3574667d6412de1f678cd062a05bab1852677ee0fdb23dc577a9831e2af402ba
MD5 d10e8b8f47c0dbe3a9115e130adfcc1a
BLAKE2b-256 b293dce00e2aacb73d49d6a7220cde2afe7c79fd27cbe2f446f954f4d5f175e1

See more details on using hashes here.

File details

Details for the file cdk_ecr_asset_scanner-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: cdk_ecr_asset_scanner-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 73.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10

File hashes

Hashes for cdk_ecr_asset_scanner-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 42a7ca8b70d58ca239a03ae1745bc9292fbf7932c6825e82cf59dfda288f3768
MD5 fc90ce35b46133fe10d231fc4d025116
BLAKE2b-256 b6918083514e81a5fb02335716c7b51930516560bb05933e1c9e30c0bbd2e31c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page