I’m running a zap server with docker in order to run scans and then run jest test against the result. Locally it is working fine since the server is running on 0.0.0.0:8081 and in the tests i’m proxying zap to localhost:8081 but on circleci the server is running on 0.0.0.0:8081 and the circleci address is set to 127.0.0.1 resulting in test failures. Anyone has an idea of how to change circle’s host address and make it run on localhost instead of 127.0.0.1 ? Even if i change the proxy and run the server on 127.0.0.1 it is still not working.
Here’s the config.yml for this job:
test-zap:
docker:
- image: circleci/node:8.11
- image: owasp/zap2docker-stable
name: zap
command: zap.sh -daemon -host 0.0.0.0 -port 8081 -config api.disablekey=true -config
api.addrs.addr.name=.* -config api.addrs.addr.regex=true
working_directory: ~/repo
steps:
- checkout
- run:
name: Wait For Proxy
command: |
until nc -z zap 8081
do
echo "Waiting for ZAP..."
sleep 1
done
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Remove lock file
command: rm yarn.lock
- run:
name: Install dependencies
command: yarn install
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Run zap test
command: yarn test:zap
and here’s the zap configuration that i’m doing:
const zapOptions = {
apiKey: '90qqdvuco5afvfglnn02oplss0',
proxy: 'http://localhost:8081/',
};
const zaproxy = new ZapClient(zapOptions);