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 repositorythe 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:
at the
docker run
stage (error:<output indicates no files found, meaning the local dir was not mounted>
)"
File doesn't exist
" error when attempting to read in an OpenAPI specification
Miscellaneous:
See Issue 4794 on GitLab's issue list for more details