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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@enterprise-cmcs/serverless-waf-plugin

v1.4.0

Published

## This is a serverless plugin which has an intelligent set of rules for a waf.

Downloads

1,751

Readme

@enterprise-cmcs/serverless-waf-plugin

This is a serverless plugin which has an intelligent set of rules for a waf.

Getting Started

To install the required plugins run the following commands:

npm i -D @enterprise-cmcs/serverless-waf-plugin
npm i -D serverless-associate-waf

Notes

This plugin is meant to be used in conjunction with another plugin called serverless-associate-waf

This plugin simply creates the waf and the above plugin will associate the waf with the desired resource.

Example usage

There are a few configuration options that can be set in the serverless.yml but if you do not need to customize the waf rules at all then simply including the plugin will suffice. The naming convention used for the waf that this plugin generates is the following.

[stage-name]-[service-name]-webacl

This is important to note as you will be using this name in the associate waf plugin to associate the resource. Below is an example of what a serverless.yml file will look like (the peices that need configured).

plugins:
  - "@enterprise-cmcs/serverless-waf-plugin"
  - serverless-associate-waf

custom:
  stage: ${opt:stage, self:provider.stage}
  webAclName: ${self:custom.stage}-${self:service}--webacl
  associateWaf:
    name: ${self:custom.webAclName}
    version: V2

There are also currently three customizable rules that can be used by the waf plugin. They are the following:

  • awsCommon
  • awsIpReputation
  • awsBadInputs

Below is an example of how you would set an exclude rule in the serverless.yml file:

custom:
    wafExcludeRules:
        awsCommon:
            - "SizeRestrictions_BODY"

Below is an example of how you would set a custom rate-limit (to protect against ddos attacks) in the serverless.yml file:

(Note: if no value is set for the rate limit the default is 5000)

custom:
    wafExcludeRules:
        awsRateLimit: 200

Below is an example of how to enable logging to cloudwatch from within the serverless.yml file. The cloudwatch log group will be called aws-waf-logs-[stage-name]-[service-name]-webacl:

(Note: The default value for logging is set to false meaning ther will be no logs)

custom:
    wafExcludeRules:
        enableLogging: true

Here is an example of how to set the scope of the web acl. This is important if you need to have a web acl for a cloudfront distribution. The default is REGIONAL and there are two options (REGIONAL & CLOUDFRONT)

custom:
    wafExcludeRules:
        wafScope: CLOUDFRONT

The resource name of the web acl that is generated by this plugin is WafPluginAcl. This resource name will be important if you need to access the resource from within your serverless.yml. An example of when this would be necessary is for associating the web acl with a cloudfront distribution.