Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

aws-actions/vulnerability-scan-github-action-for-amazon-inspector

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
Open more actions menu

Repository files navigation

Vulnerability Scan GitHub Action for Amazon Inspector

Amazon Inspector is a vulnerability management service that scans AWS workloads and CycloneDX SBOMs for known software vulnerabilities.

This GitHub Action allows you to scan supported artifacts for software vulnerabilities using Amazon Inspector from your GitHub Actions workflows.

An active AWS account is required to use this action.

Overview

This action works by first generating a CycloneDX software bill of materials (SBOM) for the provided artifact. The SBOM is then sent to Amazon Inspector and scanned for known vulnerabilities.

This action can scan the following artifact types for vulnerabilities:

  1. Files and directories in your GitHub repository
  2. Container images
  3. Compiled Go and Rust binaries (stripped and obfuscated binaries are not supported)
  4. Archives (.zip, .tar, .tar.gz)

For more information, please refer to Amazon Inspector's supported artifacts and container operating systems.

To learn more about Amazon Inspector, as well as Inspector's free trial and pricing model, please see the links below:

  1. https://aws.amazon.com/inspector/
  2. https://aws.amazon.com/inspector/pricing/?nc=sn&loc=3

Prerequisites

  1. Required: You must have an active AWS account to use this action. Guidance on creating an AWS account is provided here.

  2. Required: You must have read access to the InspectorScan:ScanSbom API. See here for configuration instructions .

  3. Required: You must configure AWS authentication for use in GitHub action workflows. We recommend using configure-aws-credentials for this purpose.

  4. Required: Create a GitHub Actions workflow if you do not already have one. Guidance on doing so is available here.

  5. Required: Configure Dependabot to keep this action up to date so you receive the latest bug fixes and security updates. Guidance on doing so is available here .

  6. Optional: Configure container registry authentication if needed. GitHub Actions are available for this purpose including Docker Login.

Usage

Quick Start

Perform the following steps to quickly add this action to your GitHub Actions pipeline:

  1. Copy and paste the following YAML block into your workflow file.

    Read through this workflow definition and make changes to suit your environment:

    name: Scan artifact with Amazon Inspector
    on: [push]
    jobs:
     daily_job:
       runs-on: ubuntu-latest
    
       # change this to match your GitHub Secrets environment
       environment:
         name: your_github_secrets_environment
    
       steps:
    
         # modify this block based on how you authenticate to AWS
         # make sure you have permission to access the Inspector ScanSbom API
         # https://docs.aws.amazon.com/inspector/latest/user/configure-cicd-account.html#cicd-iam-role
         - name: Configure AWS credentials
           uses: aws-actions/configure-aws-credentials@v4
           with:
             aws-region: "us-east-1"
             role-to-assume: "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_ROLE_NAME>"
    
         # Check out your repository if needed
         - name: Checkout this repository
           uses: actions/checkout@v4
    
         # modify this block to scan your intended artifact
         - name: Inspector Scan
           id: inspector
           uses: aws-actions/vulnerability-scan-github-action-for-amazon-inspector@v1
           with:
             # change artifact_type to either 'repository', 'container', 'binary', or 'archive'.
             artifact_type: 'repository'
    
             # change artifact_path to the file path or container image you would like to scan.
             # File paths should be relative to your root project directory.
             # For containers, this action accepts 'docker pull'-style references to containers,
             # such as 'alpine:latest' or a file path to an image exported as TAR using docker save.
             artifact_path: './'
    
             # If enabled, this setting will display Inspector's vulnerability scan findings
             # as a GitHub actions step summary. See here for an example step summary:
             # https://github.com/aws-actions/vulnerability-scan-github-action-for-amazon-inspector/actions/runs/8800085041
             display_vulnerability_findings: "enabled"
    
             # Set vulnerability thresholds; if the number of vulnerabilities is
             # equal to or greater than any of the specified thresholds, this
             # action will set the 'vulnerability_threshold_exceeded'
             # output flag to 1.
             critical_threshold: 1
             high_threshold: 1
             medium_threshold: 1
             low_threshold: 1
             other_threshold: 1
    
             # Additional input arguments are available to control scan behavior.
             # See 'action.yml' for additional input/output options.
    
    
         # The following steps illustrate how to
         # display scan results in the GitHub Actions job terminal.
         - name: Display CycloneDX SBOM (JSON)
           run: cat ${{ steps.inspector.outputs.artifact_sbom }}
    
         - name: Display Inspector vulnerability scan results (JSON)
           run: cat ${{ steps.inspector.outputs.inspector_scan_results }}
    
         - name: Display Inspector vulnerability scan results (CSV)
           run: cat ${{ steps.inspector.outputs.inspector_scan_results_csv }}
    
         - name: Display Inspector vulnerability scan results (Markdown)
           run: cat ${{ steps.inspector.outputs.inspector_scan_results_markdown }}
    
    
         # The following steps illustrate how to
         # upload scan results as a GitHub actions job artifact
         - name: Upload Scan Results
           uses: actions/upload-artifact@v4
           with:
             name: Inspector Vulnerability Scan Artifacts
             path: |
               ${{ steps.inspector.outputs.inspector_scan_results }}
               ${{ steps.inspector.outputs.inspector_scan_results_csv }}
               ${{ steps.inspector.outputs.artifact_sbom }}
               ${{ steps.inspector.outputs.inspector_scan_results_markdown }}
    
    
           # This step illustrates how to add custom logic if
           # the vulnerability threshold is exceeded. This example
           # simply prints the 'vulnerability_threshold_exceeded' value
           # to the GitHub actions job terminal.
           # Replace 'echo' with 'exit' if you want to fail the job.
         - name: On vulnerability threshold exceeded
           run: echo ${{ steps.inspector.outputs.vulnerability_threshold_exceeded }}
  2. Save your workflow file, then git commit / git push the workflow to GitHub.

GitHub should automatically run your new workflow; review its results and make any needed changes to the input and output arguments.

For additional examples, see this repository's workflow definitions.

Configuring Vulnerability Scan Outputs

By default, this action only displays the number of vulnerabilities detected in the GitHub Actions job terminal. Detailed findings are optional and configurable as JSON, CSV, or Markdown. In addition, an artifact inventory is available as a CycloneDX JSON file.

The below example shows how to enable action outputs in various locations and formats.

Exercise caution to ensure you do not accidentally post vulnerability information to untrusted viewers.

- name: Scan container
  id: inspector
  uses: aws/vulnerability-scan-github-action-for-amazon-inspector@v1
  with:
    artifact_type: 'container'
    artifact_path: 'ubuntu:14.04'
    display_vulnerability_findings: "enabled"

# Display Inspector results in the GitHub Actions terminal
- name: Display CycloneDX SBOM (JSON)
  run: cat ${{ steps.inspector.outputs.artifact_sbom }}

- name: Display Inspector vulnerability scan results (JSON)
  run: cat ${{ steps.inspector.outputs.inspector_scan_results }}

- name: Display Inspector vulnerability scan results (CSV)
  run: cat ${{ steps.inspector.outputs.inspector_scan_results_csv }}

- name: Display Inspector vulnerability scan results (markdown)
  run: cat ${{ steps.inspector.outputs.inspector_scan_results_markdown }}


# Upload Inspector outputs as a .zip that can be downloaded
# from the GitHub actions job summary page.
- name: Upload Scan Results
  id: inspector
  uses: actions/upload-artifact@v4
  with:
  path: |
    ${{ steps.inspector.outputs.inspector_scan_results }}
    ${{ steps.inspector.outputs.inspector_scan_results_csv }}
    ${{ steps.inspector.outputs.artifact_sbom }}

Publishing to GitHub Code Scanning

The action can emit findings in SARIF format, which GitHub Code Scanning ingests to display vulnerabilities in your repository's Security tab — no custom parsing required.

SARIF generation is opt-in: set output_sarif_path to enable it. Uploading is delegated to GitHub's first-party github/codeql-action/upload-sarif action — the same way AWS authentication is delegated to configure-aws-credentials. The action produces the SARIF file; you wire it to the upload step.

permissions:
  id-token: write          # for AWS authentication (OIDC)
  contents: read
  security-events: write   # required to upload results to Code Scanning

steps:
  - uses: actions/checkout@v4

  - uses: aws-actions/configure-aws-credentials@v4
    with:
      role-to-assume: ${{ secrets.INSPECTOR_ROLE_ARN }}
      aws-region: us-east-1

  - name: Scan with Amazon Inspector
    id: inspector
    uses: aws-actions/vulnerability-scan-github-action-for-amazon-inspector@v1
    with:
      artifact_type: 'repository'
      artifact_path: './'
      output_sarif_path: 'inspector.sarif'   # enables SARIF generation

  - name: Upload to GitHub Code Scanning
    uses: github/codeql-action/upload-sarif@v3
    with:
      sarif_file: ${{ steps.inspector.outputs.inspector_scan_results_sarif }}

Notes:

  • Findings appear under Security → Code scanning keyed by vulnerability ID (e.g. CVE), with severity ranking derived from the CVSS score.
  • Findings suppressed via the ignore list are excluded from the SARIF, consistent with the other report formats.
  • security-events: write is required by the upload step; Code Scanning is available on public repositories and on private repositories with GitHub Advanced Security.

Configuring Vulnerability Thresholds

This action allows the user to set vulnerability thresholds.

Vulnerability thresholds can be used to support custom logic, such as failing the workflow if any vulnerabilities are found.

The example below shows how to set up vulnerability thresholds and fail the job when the threshold is exceeded:

- name: Invoke Amazon Inspector Scan
  id: inspector
  uses: aws/vulnerability-scan-github-action-for-amazon-inspector@v1
  with:
    artifact_type: 'repository'
    artifact_path: './'
    display_vulnerability_findings: "enabled"

    # If the number of vulnerabilities equals or exceeds
    # any of the specified vulnerability thresholds, this action
    # sets a flag, 'vulnerability_threshold_exceeded' to 1, else 0.
    # To ignore thresholds for a given severity, set its value to 0.
    # This example sets 'vulnerability_threshold_exceeded' flag if
    # one or more criticals, highs, or medium severity vulnerabilities
    # are found; lows and other type vulnerabilities will not set
    # the 'vulnerability_threshold_exceeded' flag.
    critical_threshold: 1
    high_threshold: 1
    medium_threshold: 1
    low_threshold: 0
    other_threshold: 0

# Fail the job with 'exit 1' if vuln threshold flag is set
- name: On vulnerability threshold exceeded
  run: exit ${{ steps.inspector.outputs.vulnerability_threshold_exceeded }}

Ignoring Specific Findings

You can suppress specific findings so they are excluded from reports and do not count towards vulnerability thresholds.

There are two ways to define findings to ignore, and both can be combined:

1. ignore_findings input parameter — provide a comma-separated list of finding IDs (CVE, GHSA, etc.) directly in the workflow:

- name: Inspector Scan
  id: inspector
  uses: aws-actions/vulnerability-scan-github-action-for-amazon-inspector@v1
  with:
    artifact_type: 'repository'
    artifact_path: './'
    critical_threshold: 1
    ignore_findings: "CVE-2021-12345,CVE-2022-67890,GHSA-mqqf-5wvp-8fh8"

2. .inspector-ignore file — place a plain text file named .inspector-ignore at the root of your repository (the workflow's working directory — the same place you'd keep .gitignore). The file is read regardless of which artifact type is being scanned. One finding ID per line; lines starting with # and inline # comments are ignored:

# .inspector-ignore
CVE-2021-12345  # accepted risk: no fix available, mitigated by network controls
CVE-2022-67890
GHSA-abcd-1234-efgh

Findings listed in either location are removed from all output reports (JSON, CSV, Markdown) and are not counted when evaluating vulnerability thresholds.

Build and Scan Container Images

This action supports a common use case that entails building a container image, scanning the built image for vulnerabilities, and optionally, failing the workflow before the image is deployed to a container registry or elsewhere.

We provide an example of this workflow below. You must modify this workflow to suit your environment:

name: Build & Scan Container Image

on: [ push ]

jobs:
  build:
    name: Build docker image
    runs-on: ubuntu-latest
    environment:
      # change this to match your GitHub secrets environment
      name: plugin-development

    steps:
      # checkout the repository containing our Dockerfile
      - name: Checkout this repository
        uses: actions/checkout@v4

      # Setup prerequisites for docker/build-push-action
      - name: Set up docker build prereqs (QEMU)
        uses: docker/setup-qemu-action@v3

      - name: Set up docker build prereqs (Buildx)
        uses: docker/setup-buildx-action@v3

      # build the image you wish to scan
      - name: Build Docker image
        uses: docker/build-push-action@v5
        with:
          context: .
          file: ./Dockerfile
          push: false
          tags: app:latest
          load: true

      # setup your AWS credentials
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          aws-region: "us-east-1"
          role-to-assume: "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_ROLE_NAME>"

      - name: Scan built image with Inspector
        uses: aws-actions/vulnerability-scan-github-action-for-amazon-inspector@v1
        id: inspector
        with:
          artifact_type: 'container'
          artifact_path: 'app:latest' # make sure this matches the image you built
          critical_threshold: 1
          high_threshold: 1
          medium_threshold: 1
          low_threshold: 1
          other_threshold: 1
          # set additional arguments as needed

      - name: Fail job if vulnerability threshold is exceeded
        run: exit ${{ steps.inspector.outputs.vulnerability_threshold_exceeded }}

        # add any additional steps for deploying your image

Action Inputs and Outputs

The following input and output options are provided by this action. See action.yml for more detail.

Input Options

Name Description Required Default
artifact_type The artifact you would like to scan with Amazon Inspector. Valid choices are "repository", "container", "binary", or "archive". True repository
artifact_path The file path to the artifact you would like to scan with Amazon Inspector. File paths are relative to the root project directory. If scanning a container image, you must provide a value that follows the docker pull convention. For example, "alpine:latest", or a path to an image exported as tarball using "docker save". True ./
display_vulnerability_findings If set to "enabled", the action will display detailed vulnerability findings in the action summary page; see here for an example: https://github.com/aws-actions/vulnerability-scan-github-action-for-amazon-inspector/actions/runs/8742638284/attempts/1#summary-23991378549 True disabled
output_sbom_path The destination file path for the generated SBOM. False ./sbom_${{ github.run_id }}.json
output_inspector_scan_path The destination file path for Inspector's vulnerability scan (JSON format). False inspector_scan_${{ github.run_id }}.json
output_inspector_scan_path_csv The destination file path for Inspector's vulnerability scan (CSV format). False inspector_scan_${{ github.run_id }}.csv
output_inspector_scan_path_markdown The destination file path for Inspector's vulnerability scan (markdown format). False inspector_scan_${{ github.run_id }}.md
output_sarif_path The destination file path for Inspector's vulnerability scan (SARIF format). SARIF is generated only when this value is set. Provide the resulting file to github/codeql-action/upload-sarif to publish findings to GitHub Code Scanning. See Publishing to GitHub Code Scanning. False '' (disabled)
sbomgen_version The inspector-sbomgen version you wish to use for SBOM generation. See here for more info: https://docs.aws.amazon.com/inspector/latest/user/sbom-generator.html False latest
critical_threshold Specifies the number of critical vulnerabilities needed to set the 'vulnerability_threshold_exceeded' flag. False 0
high_threshold Specifies the number of high vulnerabilities needed to set the 'vulnerability_threshold_exceeded' flag. False 0
medium_threshold Specifies the number of medium vulnerabilities needed to set the 'vulnerability_threshold_exceeded' flag. False 0
low_threshold Specifies the number of low vulnerabilities needed to set the 'vulnerability_threshold_exceeded' flag. False 0
other_threshold Specifies the number of other vulnerabilities needed to set the 'vulnerability_threshold_exceeded' flag. False 0
scanners Specifies the file scanners that you would like inspector-sbomgen to execute. By default, inspector-sbomgen will try to run all file scanners that are applicable to the target artifact. If this argument is set, inspector-sbomgen will only execute the specified file scanners. Provide your input as a single string. Separate each file scanner with a comma. For example: scanners: dpkg,python-requirements,javascript-npm-packagelock To view a list of available file scanners, execute 'inspector-sbomgen list-scanners'. See here for more info: https://docs.aws.amazon.com/inspector/latest/user/sbom-generator.html False ''
skip_scanners Specifies a list of file scanners that should NOT be executed; this argument cannot be combined with 'scanners'. If this argument is set, inspector-sbomgen will execute all file scanners except those you specified. Provide your input as a single string. Separate each file scanner with a comma. For example: skip_scanners: 'binaries,alpine-apk,dpkg,php'To view a list of available file scanners, execute 'inspector-sbomgen list-scanners'. See here for more info: https://docs.aws.amazon.com/inspector/latest/user/sbom-generator.html False ''
additional_scanners Enables additional (opt-in) file scanners that inspector-sbomgen does not run by default. Provide your input as a single string. Separate each file scanner with a comma. To view a list of available file scanners, execute 'inspector-sbomgen list-scanners'. See here for more info: https://docs.aws.amazon.com/inspector/latest/user/sbom-generator.html False ''
skip_files Specifies one or more files and/or directories that should NOT be inventoried. Separate each file with a comma and enclose the entire string in double quotes, for example: skip_files: "./media,/tmp/foo/,/bar/my_program" False ''
plugin_dir Path to a directory containing custom Lua plugins for inspector-sbomgen to load (file discovery and package collection). The path is resolved inside the action container, so it should be within your checked-out workspace. False ''
skip_nested_pomxml If set to true, inspector-sbomgen will not collect dependencies declared in pom.xml files that are nested inside compiled jar archives. False false
timeout Specifies a timeout in seconds. If this timeout is exceeded, the action will gracefully conclude and present any findings discovered up to that point. Default value is 600 seconds or 10 minutes. False 600
max_file_size Skip files larger than this many bytes during directory traversal. Set to 0 (the default) to disable the limit. False 0
max_read_file_size Cap a single buffered file read at this many bytes to prevent out-of-memory conditions. Set to 0 to disable the cap. -1 (the default) leaves inspector-sbomgen's built-in default in effect. False -1
depth Limit directory traversal to the specified recursion depth. Set to -1 (the default) to leave inspector-sbomgen's built-in recursion behavior in effect. False -1
ignore_findings A comma-separated list of finding IDs to suppress. Ignored findings are excluded from all output reports and do not count towards vulnerability thresholds. You can also place a plain-text .inspector-ignore file at the root of your repository (the workflow's working directory; one ID per line, # for comments). See Ignoring Specific Findings. Example: CVE-2021-12345,CVE-2022-67890,GHSA-mqqf-5wvp-8fh8 False ''
license_collection If set to true, inspector-sbomgen collects SPDX license metadata during SBOM generation and the action renders a license inventory report (CSV and markdown), also posting it to the step summary. License collection is supported for select ecosystems; the report is empty for unsupported ecosystems. False false
collect_ml_models If set to true, inspector-sbomgen scans for machine learning models (e.g., Hugging Face) during SBOM generation. False false
enable_debug_props If set to true, inspector-sbomgen adds debug properties to the SBOM (such as source file scanners and package collectors) to aid troubleshooting. False false
debug_file_paths If set to true, inspector-sbomgen emits per-path directory-walk debug logging. Applies to repository/directory, archive, and volume scans. False false

Output Options

Name Description
artifact_sbom The file path to the artifact's software bill of materials.
inspector_scan_results The file path to the Inspector vulnerability scan findings in JSON format.
inspector_scan_results_csv The file path to the Inspector vulnerability scan findings in CSV format.
inspector_scan_results_markdown The file path to the Inspector vulnerability scan findings in markdown format.
inspector_scan_results_sarif The file path to the Inspector vulnerability scan findings in SARIF format. Produced only when output_sarif_path is set. Pass to github/codeql-action/upload-sarif.
inspector_malware_scan_results_markdown The file path to the Inspector malware (known-compromised package) findings in markdown format. These are surfaced in a dedicated step-summary section, separate from CVE, Dockerfile, and license findings.
inspector_license_results_csv The file path to the collected license inventory in CSV format. Produced only when license_collection is enabled.
inspector_license_results_markdown The file path to the collected license inventory in markdown format. Produced only when license_collection is enabled.
vulnerability_threshold_exceeded This variable is set to 1 if any vulnerability threshold was exceeded, otherwise it is 0. This variable can be used to trigger custom logic, such as failing the job if vulnerabilities were detected.

Get Help

For general questions about this action, please post your question to the project's discussion page:

You may also consider exploring these resources for additional help with AWS products and services:

Bugs

If you encountered a bug, please open a GitHub issue:

Contributing

Contributions are welcome. This project uses a proposal-first workflow: before opening a substantive pull request, please open a Feature Proposal issue so we can align on the change and, if accepted, assign it to you. Trivial fixes (typos, one-line doc changes, broken links) may be submitted directly as a pull request against the develop branch.

See CONTRIBUTING.md for the full guidelines.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the MIT license.

This project leverages the Amazon Inspector SBOM Generator, which is distributed under the AWS Intellectual Property License.

Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved

Releases

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.