Add Application Security scans into your GitHub workflow

Scan for vulnerabilities and prevent potential exploits before publishing changes to your production environment by using the Application Security integration with GitHub Actions.

You can include Application Security scans in your CI/CD build pipeline workflow by adding the scan action and subsequent steps to your GitHub workflow.

Scan gating

You can set gating criteria with this integration to prevent risky code from entering your production environment. One way to use scan gating is to set build pass/fail criteria for vulnerabilities. When the scan finds vulnerabilities that meet or exceed your gating criteria, you can set a step to follow, such as failing the workflow so that code is not deployed to production.

The scan gating query can be anything the search vulnerability endpoint can accept, not just limited to severity. For more information, see the Application Security API documentation.

What you’ll need

To make your configuration easier, have the following pieces of information available:

  • Application Security API key
  • Scan Config ID of the Application Security scan that you want to run

Integrate Application Security in GitHub

Add the Application Security API Key as a secret in GitHub, otherwise the action won’t work. See the GitHub documentation for information about adding API keys as secrets: https://docs.github.com/en/actions/security-guides/encrypted-secrets

Access the Rapid7 Application Security action in one of the following ways:

Add the Application Security scan as an action to your GitHub workflow

In your GitHub workflow YML file, add the following to the jobs: section, using your own details:

Copy
scan:
  runs-on: ubuntu-latest
  steps:
    - id: my-scan
      uses: rapid7/insightappsec-scan-github-actions@v1.1.0
      with:
        region: "us"
        api-key: ${{ secrets.IAS_API_KEY }}
        scan-config-id: "999703e4-a4p0-4ea6-a3sc-53cg789e4fc1"
        vuln-query: "vulnerability.severity = 'MEDIUM'"
    - name: Upload findings
      if: always()
      run: echo "${{ steps.my-scan.outputs.scan-findings }}"

Update to a new version

When a new version of the extension is available, manually update the uses: value in the yaml file with the new version number.

View results

During the scan, you can view scan progress in both GitHub and Application Security on the Scanning Activity page. When the scan completes and the results are automatically sent back to GitHub, you can view your results in the build results and in Application Security .