StackHawk Documentation StackHawk Logo HawkDocs

No results found

Try different keywords or check your spelling

Search documentation

Find guides, API references, and more

↑ ↓ ↵ esc

Vulnerability Report

GitLab

With StackHawk’s code scanning integration in Gitlab, teams can now run Dynamic API and Application Security Testing (DAST) whenever they check-in code and view results directly in GitLab.

StackHawk:

  • You must have a StackHawk account.

GitLab:

Enabling Vulnerability Reporting in GitLab with HawkScan

This integration can be broken down into four major steps:

  • Configuring StackHawk to run in your GitLab pipeline
  • Updating your GitLab pipeline to create a DAST report
  • Running your pipeline
  • Viewing and triaging results

You can add StackHawk scanning to your GitLab pipeline by adding scanning to your .gitlab-ci.yml and adding a stackhawk.yml configuration file to your repository. Detailed set up instructions can be found in HawkScan and GitLab

Once you have set up scanning in your GitLab pipeline, you need to add two things to your .gitlab-ci.yml.

First, set the DAST_ARTIFACT environment variable to tell HawkScan to write a DAST report, stackhawk-dast-report.json, to your repository directory when the scan finishes.

Next, add stackhawk-dast-report.json to the job’s DAST report artifacts.

Your updated StackHawk job should look something like this:

.gitlab-ci.yml
hawkscan:
  image: ubuntu:22.04
  variables:
    DAST_ARTIFACT: "true"
    # Optional: pin a version (6.0.0 or later). Leave it unset to install the latest release.
    # HAWK_INSTALL_VERSION: "6.6.0"
  before_script:
    - apt-get update -qq && apt-get install -qq -y curl
    - curl -fsSL https://download.stackhawk.com/hawk/install.sh | sh
    - export PATH="$HOME/.hawk/bin:$PATH"
  script:
    - hawk --api-key="hawk.${HAWK_API_ID}.${HAWK_API_SECRET}" scan
  artifacts:
    reports:
      dast: stackhawk-dast-report.json

This job installs the hawk CLI with the install script, adds it to the PATH, and runs the scan. See HawkScan and GitLab for details.

If you run HawkScan as a Docker container, pass DAST_ARTIFACT into the container instead:

.gitlab-ci.yml
hawkscan:
  image: docker
  services:
    - docker:dind
  before_script:
    - docker pull stackhawk/hawkscan
  script:
    - |
      docker run -v $(pwd):/hawk:rw -t \
        -e API_KEY="hawk.${HAWK_API_ID}.${HAWK_API_SECRET}" \
        -e NO_COLOR=true \
        -e DAST_ARTIFACT=1 \
        stackhawk/hawkscan
  artifacts:
    reports:
      dast: stackhawk-dast-report.json

The actions that trigger your build pipeline, such as code changes and creating pull requests, will now trigger running HawkScan and creating a vulnerability report.

The vulnerability report is included in the Security and Compliance section of GitLab.

To view the vulnerabilities that StackHawk found in your application, navigate to the Vulnerability Report section of the Security and Compliance center.

Security And Compliance Section

This should give you an overview of all your vulnerabilities.

Vulnerability Report

Click into each vulnerability to view details and create issues by clicking on the Create Issue button on the bottom of the page.

Vulnerability Details

Your privacy settings

We use first and third party cookies to ensure that we give you the best experience on our website and in our products.