Skip to main content
All CollectionsCI/CD Integration
HawkScan fails to read OpenAPI specification file when running in GitLab
HawkScan fails to read OpenAPI specification file when running in GitLab
AJ avatar
Written by AJ
Updated over 2 years ago

Issue

HawkScan has been configured to run in a GitLab pipeline, and:

  • the configuration files stackhawk.yml and .gitlab-ci.yml are present in the root of the repository

  • the OpenAPI spec file is present as yaml or json in the same repo root

  • app.openApiConf is configured to point to the spec file (e.g., in app.openApiConf.filePath)

However, the scan fails with the following error:

[File doesn't exist /hawk/example_filename.yml]

or

[File doesn't exist /hawk/example_filename.json]

Cause

Docker socket issue in the runners.docker config (docker.sock not mapped into the container).

Solution

Either:

  • Add -v /var/run/docker.sock:/var/run/docker.sock to the Docker command in .gitlab-ci.yml

  • Add volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"] to the docker config for the StackHawk runner

For example:

[[runners]]
name = "stackhawk-test"
url = "https://git.example.org/"
token = "xxxxxxxxxxxxxxxxxxxx"
executor = "docker"
[runners.docker]
tls_verify = false
image = "docker:stable"
privileged = true
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
shm_size = 0

Additional Information

Other Incarnations:

This docker socket issue in can manifest elsewhere in the GitLab environment, such as:

Miscellaneous:

  • See Issue 4794 on GitLab's issue list for more details

Did this answer your question?