Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
shield

GitHub Action

cfn-security

v1.0.0

cfn-security

shield

cfn-security

CloudFormation Static Code Analysis Tool Suite

Installation

Copy and paste the following snippet into your .yml file.

              

- name: cfn-security

uses: grolston/[email protected]

Learn more about this action in grolston/cfn-security

Choose a version

cfn-security

A simple GitHub Action for AWS CloudFormation static code analysis to improve infrastructure-as-code security.

The Action does not require AWS credentials!

cfn-security supports the following linting and security tools:

Inputs

cloudformation_directory

The directory of the repo to scan the cloudformation templates.

scanner

The scanner used to run security test. Options are cfn-lint, cfn-nag, checkov, or all

Usage

To get started simply add a workflow .yml file (name it whatever you would like) to your .github/workflows folder. Refer to the documentation on workflow YAML syntax here..

For examples GitHub Actions workflow files check out the example workflow templates. If you still do not know where to start, just use the all-security-scans.yml template which will create two security scan jobs. Update the template input vars as necessary.

Example cfn-lint Test

The following example tests CloudFormation with cfn-lint:

name: cfn-lint Scan

on: [push]

jobs:
  ## cfn-lint scan
  sast-cfn-lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: grolston/cfn-security@v1
      with:
        cloudformation_directory: './cloudformation/' ## change to your template directory
        scanner: "cfn-lint"

Example cfn-nag Test

The following example tests CloudFormation with cfn-nag:

name: cfn-nag Security Scan

on: [push]

jobs:
  ## cfn-nag security scan
  sast-cfn-nag:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: grolston/cfn-security@v1
      with:
        cloudformation_directory: './cloudformation/' ## change to your template directory
        scanner: "cfn-nag"

Example checkov Test

The following example tests CloudFormation with checkov:

name: checkov Security Scan

on: [push]

jobs:
  ## checkov security scan
  sast-checkov:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: grolston/cfn-security@v1
      with:
        cloudformation_directory: './cloudformation/' ## change to your template directory
        scanner: "checkov"

Note: it is possible to simple combine the two examples above into a single file which will run all tests as individual jobs. Reference all-security-scans.yml

License

This project is distributed under the MIT license.