npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jaykingson/cdk-nag-custom-nag-pack

v0.0.12

Published

[![All Contributors](https://img.shields.io/github/all-contributors/JohannesKonings/cdk-nag-custom-nag-pack?color=ee8449&style=flat-square)](#contributors)

Readme

cdk-nag-custom-nag-pack

All Contributors

rules

| Rule ID | Cause | Explanation | | ------- | ----------------------------- | -------------------------------------------- | | CR1 | Defined tags do not exist | Certain tags are checked for existence | | CR2 | Defined tags have wrong value | Certain tags are checked with defined values |

global suppressions

custom resource

The AwsCustomResource (https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.custom_resources.AwsCustomResource.html) creates a singleton lambda function and can't suppress at the resource level via addResourceSuppressions because it creates a lambda function resource on the stack.

In most cases, all the resources which are created are managed by the CDK, so it's OK to suppress that "behind the scenes".

custom resource template

The same applies to BucketDeployment (https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_deployment-readme.html).

Handled custom resource types:

  • Custom::AWS
  • Custom::LogRetention
  • Custom::CDKBucketDeployment
  • Custom::S3BucketNotifications
  • Custom::SopsSync

custom checks suppressions

This package exposes CustomChecksSuppressions as a central place for cdk-nag suppression helpers.

cdk-nag suppression for log buckets (AwsSolutions-S1)

There are two ways a bucket can be treated as a log bucket:

  1. Derived in-app: when enableLogBucketTagger: true is enabled, this package identifies buckets that are used as serverAccessLogsBucket destinations and automatically tags + suppresses AwsSolutions-S1.
  2. Manually marked: if a bucket in this CDK app will be used externally as a log bucket (and this cannot be derived from serverAccessLogsBucket usage in the same app), you can mark it explicitly.

Important: LogBucketTagger is the single source of truth for the log-bucket tag names/values. CustomChecksSuppressions.addS1SuppressionAndTagAsLogBucket(...) delegates tagging to LogBucketTagger so the defaults (and any custom tag configuration) stay consistent.

Reason used: "This is intended to be a log bucket. Log bucket does not require access logging to prevent infinite loop"

granular AwsSolutions-IAM5 suppressions

The AwsSolutions-IAM5 rule flags IAM policies that use wildcard permissions (*) in actions or resources. While wildcards should generally be avoided, some AWS services require them for proper functionality (e.g., X-Ray tracing).

This package provides CustomChecksSuppressions.addIam5StatementResourceSuppressions() for granular suppression of specific IAM policy statements. Instead of suppressing all IAM5 findings for a resource, you can suppress only the exact policy statements that genuinely require wildcards.

Example usage
import { CustomChecksSuppressions } from '@jaykingson/cdk-nag-custom-nag-pack'

const policyStatementForSuppression: PolicyStatementProps = {
  actions: ['xray:PutTelemetryRecords', 'xray:PutTraceSegments'],
  resources: ['*'],
  effect: Effect.ALLOW,
};

CustomChecksSuppressions.addIam5StatementResourceSuppressions(
  lambda,
  {
    id: 'AwsSolutions-IAM5',
    reason: 'Wildcard required for X-Ray - see https://docs.aws.amazon.com/xray/latest/devguide/security_iam_service-with-iam.html',
    appliesTo: [policyStatementForSuppression],
  },
  true, // applyToChildren
);
helpers
import { CustomChecksSuppressions } from '@jaykingson/cdk-nag-custom-nag-pack'

// Marks the bucket as a log bucket (tags + suppresses AwsSolutions-S1)
CustomChecksSuppressions.addS1SuppressionAndTagAsLogBucket(myLogBucket);

log bucket tagger

Third-party security scanners often flag S3 buckets that don't have server access logging enabled. However, log buckets themselves cannot have their own log bucket (that would create infinite recursion). The enableLogBucketTagger option automatically tags S3 buckets used as logging destinations, making it easier for security scanners to identify and exclude them from "missing logging" checks.

Tags applied

| Tag Name | Tag Value | Description | | -------- | --------- | ----------- | | isLogBucket | true | Identifies the bucket as a log destination | | LogBucketTaggedBy | cdkNagCustomChecks | Identifies that this package applied the tag |

Note: The defaults above are owned by LogBucketTagger. If you configure custom tag names/values on LogBucketTagger, those will be used consistently for both auto-tagging and manual marking.

How it works

The tagger identifies log buckets by inspecting the LoggingConfiguration.DestinationBucketName property of S3 buckets. It supports:

  • Same-stack references via Ref or Fn::GetAtt
  • Cross-stack references via Fn::ImportValue (when applied at App level)

Note: Buckets referenced by string literals (external bucket names) cannot be tagged as they exist outside the CDK app.

Usage

Aspects.of(app).add(new CustomChecks({
  enableLogBucketTagger: true,
}));

Note: When enableLogBucketTagger: true is enabled, the log bucket AwsSolutions-S1 suppression is applied automatically to identified log buckets.

If you create a bucket that will be used as a log bucket by systems outside of this CDK app, you can manually mark it using CustomChecksSuppressions.addS1SuppressionAndTagAsLogBucket(...).

config

import { CustomChecks } from '@jaykingson/cdk-nag-custom-nag-pack'
...
Aspects.of(app).add(new CustomChecks({
  // use the whole set of this rules https://github.com/cdklabs/cdk-nag/blob/main/RULES.md#awssolutions
  enableAwsSolutionChecks: true,
  // use whatever tags you want to check
  cr1TagsToCheck: ['Environment', 'Owner'],
  cr2TagsWithValueToCheck: { Stage: ["dev", "prod"] },
  // activate the suppression of the custom resource singleton lambda
  suppressSingletonLambdaFindings: true,
  // automatically tag S3 log buckets for security scanners
  enableLogBucketTagger: true,
}));

Contributors