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

@aligent/cdk-waf

v2.5.2

Published

![TypeScript version](https://img.shields.io/github/package-json/dependency-version/aligent/cdk-constructs/dev/typescript?filename=packages/constructs/waf/package.json&color=red) ![AWS CDK version](https://img.shields.io/github/package-json/dependency-ver

Readme

Aligent AWS WAF

Overview

TypeScript version AWS CDK version NPM version

This repository defines a CDK construct for provisioning an AWS Web Application Firewall (WAF) stack. It can be imported and used within CDK applications.

Features

  • IP allowlisting and blocklisting (IPv4 and IPv6)
  • Path-based allowlisting
  • User-Agent allowlisting
  • Rate limiting with configurable aggregation
  • AWS Managed Rule Groups:
    • Known Bad Inputs (always enabled)
    • Common Rule Set (always enabled)
    • PHP Rules (optional, enabled by default)
    • IP Reputation List (optional)
    • Anonymous IP List (optional)
    • SQL Injection Protection (optional)
    • Bot Control (optional, additional costs apply)
  • CloudWatch logging with configurable retention
  • Support for both REGIONAL and CLOUDFRONT scopes
  • Custom rule injection (pre and post processing)

Installation

npm install @aligent/cdk-waf

Basic Usage

import { WebApplicationFirewall, REGIONAL, CLOUDFRONT } from '@aligent/cdk-waf';

// Minimal configuration
const waf = new WebApplicationFirewall(this, 'WAF', {
  wafName: 'my-application-waf',
});

// Access the WebACL ARN for use with other resources
const webAclArn = waf.webAclArn;

Configuration Examples

PHP Application (Default behavior)

const waf = new WebApplicationFirewall(this, 'WAF', {
  wafName: 'php-waf',
  activate: true,
  allowedIPs: [
    '10.0.0.0/8',     // Internal network
    '203.0.113.0/24', // Office IPs
  ],
  rateLimit: 2000,
});

Non-PHP Application (Node.js, Python, etc.)

const waf = new WebApplicationFirewall(this, 'WAF', {
  wafName: 'nodejs-api-waf',
  activate: true,
  enablePhpRules: false,        // Disable PHP-specific rules
  enableSqlInjection: true,     // Enable SQL injection protection
  rateLimit: 1000,
  rateLimitAggregation: 'IP',   // Use source IP instead of X-Forwarded-For
});

High-Security Configuration

const waf = new WebApplicationFirewall(this, 'WAF', {
  wafName: 'secure-waf',
  activate: true,
  blockedIPs: ['192.0.2.0/24'],           // Block known bad actors
  blockedIPv6s: ['2001:db8:bad::/48'],
  allowedIPs: ['10.0.0.0/8'],
  enablePhpRules: false,
  enableIpReputationList: true,           // Block IPs with poor reputation
  enableAnonymousIpList: true,            // Block VPNs, proxies, Tor
  enableSqlInjection: true,
  enableBotControl: true,                  // Note: Additional costs apply
  rateLimit: 500,
});

CloudFront Distribution WAF

const waf = new WebApplicationFirewall(this, 'WAF', {
  wafName: 'cloudfront-waf',
  scope: CLOUDFRONT,  // Must be deployed in us-east-1
  activate: true,
  rateLimit: 5000,
});

// Use with CloudFront
new cloudfront.Distribution(this, 'Distribution', {
  webAclId: waf.webAclArn,
  // ... other config
});

ALB Association

const waf = new WebApplicationFirewall(this, 'WAF', {
  wafName: 'alb-waf',
  scope: REGIONAL,
  activate: true,
  associations: [alb.loadBalancerArn],
  rateLimit: 1000,
});

Rule Priority Structure

| Priority | Rule | Description | |----------|------|-------------| | 1-2 | IPv4 Blocklist | Block by X-Forwarded-For and source IP | | 3-4 | IPv6 Blocklist | Block by X-Forwarded-For and source IP | | 5-9 | Pre-process custom rules | User-defined rules | | 10-15 | Allowlists | Path, IP, and User-Agent allowlists | | 20 | Bad Actors | AWS Known Bad Inputs | | 21 | Common Rules | AWS Common Rule Set | | 22 | PHP Rules | AWS PHP Rule Set (optional) | | 23 | IP Reputation | AWS IP Reputation List (optional) | | 24 | Anonymous IP | AWS Anonymous IP List (optional) | | 25 | SQL Injection | AWS SQLi Rule Set (optional) | | 26 | Bot Control | AWS Bot Control (optional) | | 30 | Rate Limiting | Rate-based blocking | | 30+ | Post-process custom rules | User-defined rules |

Monitor and Activate

By default, the WebACL works in COUNT mode. After monitoring under real traffic:

  1. Review CloudWatch logs for blocked requests
  2. Add necessary IP allowlists or excluded rules
  3. Set activate: true to enable blocking mode

Local Development

NPM link can be used to develop the module locally:

  1. Pull this repository locally
  2. cd into this repository
  3. Run npm link
  4. cd into the downstream repo and run npm link '@aligent/cdk-waf' The downstream repository should now include a symlink to this module. Allowing local changes to be tested before pushing. You may want to update the version notation of the package in the downstream repository's package.json.