JSPM

  • Created
  • Published
  • Downloads 1644
  • Score
    100M100P100Q81805F
  • License MIT

OWASP dependency-check for codecommit repositories

Package Exports

  • @cloudcomponents/cdk-dependency-check

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@cloudcomponents/cdk-dependency-check) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cloudcomponents Logo

@cloudcomponents/cdk-dependency-check

Build Status typescript

OWASP dependency-check for codecommit repositories

Install

npm i @cloudcomponents/cdk-dependency-check

How to use

import { App, Stack, StackProps } from '@aws-cdk/core';
import { Repository } from '@aws-cdk/aws-codecommit';
import { Schedule } from '@aws-cdk/aws-events';
import { SnsTopic } from '@aws-cdk/aws-events-targets';
import { Topic } from '@aws-cdk/aws-sns';
import { EmailSubscription } from '@aws-cdk/aws-sns-subscriptions';
import { CodeCommitDependencyCheck } from '@cloudcomponents/cdk-dependency-check';

export class DependencyCheckStack extends Stack {
  public constructor(scope: App, id: string, props?: StackProps) {
    super(scope, id, props);

    const repository = Repository.fromRepositoryName(
      this,
      'Repository',
      process.env.REPOSITORY_NAME as string,
    );

    // The following example runs a task every day at 4am
    const check = new CodeCommitDependencyCheck(
      this,
      'CodeCommitDependencyCheck',
      {
        repository,
        preCheckCommand: 'npm i',
        schedule: Schedule.cron({
          minute: '0',
          hour: '4',
        }),
      },
    );

    const checkTopic = new Topic(this, 'CheckTopic');

    checkTopic.addSubscription(
      new EmailSubscription(process.env.DEVSECOPS_TEAM_EMAIL as string),
    );

    check.onCheckStarted('started', {
      target: new SnsTopic(checkTopic),
    });

    check.onCheckSucceeded('succeeded', {
      target: new SnsTopic(checkTopic),
    });

    check.onCheckFailed('failed', {
      target: new SnsTopic(checkTopic),
    });
  }
}

Upload HTML Reports

const reportsBucket = new Bucket(this, 'Bucket');

// The following example runs a task every day at 4am
const check = new CodeCommitDependencyCheck(this, 'CodeCommitDependencyCheck', {
  repository,
  reportsBucket,
  preCheckCommand: 'npm i',
  schedule: Schedule.cron({
    minute: '0',
    hour: '4',
  }),
});

Example

See more complete examples.

License

MIT