CSEDevOps icon indicating copy to clipboard operation
CSEDevOps copied to clipboard

Failed to load context file - file does not exist in the docker container

Open tse00 opened this issue 2 years ago • 1 comments

Hi everyone,

I added the context file to the pipeline configuration. The file is being recognized from the docker run command otherwise it would throw an error. The docker run command creates a volume from the owasp folder path to the container. Somehow it seems like the file it's not being copied from /home/vsts/work/1/s/owaspzap/context-file.context to the container. After the docker image is pulled and the container starts, I get the error message that the context file wasn't found.

/usr/bin/chmod 777 /home/vsts/work/1/s/owaspzap
/usr/bin/id -u root
0
/usr/bin/docker run -u 0 -v /home/vsts/work/1/s/owaspzap:/zap/wrk/:rw owasp/zap2docker-stable zap-baseline.py -t [https://****:443](https://****/) -J report.json -r report.html -n /home/vsts/work/1/s/owaspzap/context-file.context
...

owasp zap docker image is pulled

...
df35e5174ca6: Pull complete
Digest: sha256:215795fee30319d4d46007e1d9bb0999d9bafdfa423bcfb690de3d40e642f302
Status: Downloaded newer image for owasp/zap2docker-stable:latest
2023-01-10 17:10:54,380 Failed to load context file /home/vsts/work/1/s/owaspzap/context-file.context : does_not_exist
Total of 815 URLs
PASS: Vulnerable JS Library (Powered by Retire.js) [10003]
...

azure-pipelines-yml config:

        - task: owaspzap@1
          inputs:
            threshold: '50'
            scantype: 'targetedScan'
            url: 'https://****'
            providedCustomContext: true
            contextPath: '$(Build.SourcesDirectory)/owaspzap/context-file.context'
            port: '443'

Was someone able to use the context file succefully?

tse00 avatar Jan 12 '23 11:01 tse00

I meet exactly the same issue. I can confirm the Context.context file is there but it keeps saying "does_not_exist". Really hope someone can help with the issue.

CaroXu avatar Jun 27 '23 21:06 CaroXu