From 5622e770f08dcf0e69986b5199b30f6d66410686 Mon Sep 17 00:00:00 2001 From: Simon Bennetts Date: Tue, 9 Sep 2025 18:07:54 +0100 Subject: [PATCH] Docker: Add chrome test Signed-off-by: Simon Bennetts --- .github/workflows/test-chrome-docker.yml | 18 +++++++++++++++++ docker/chrome/Dockerfile | 10 ++++++++++ docker/chrome/README.md | 5 +++++ docker/chrome/chrome.yaml | 25 ++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 .github/workflows/test-chrome-docker.yml create mode 100644 docker/chrome/Dockerfile create mode 100644 docker/chrome/README.md create mode 100644 docker/chrome/chrome.yaml diff --git a/.github/workflows/test-chrome-docker.yml b/.github/workflows/test-chrome-docker.yml new file mode 100644 index 00000000000..005040cdfed --- /dev/null +++ b/.github/workflows/test-chrome-docker.yml @@ -0,0 +1,18 @@ +name: Test Chrome in nightly Docker +on: + workflow_dispatch: + #schedule: + # TODO schedule + +jobs: + publish: + name: Build Test Chrome Docker Image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Build and test the image + run: | + cd docker/chrome + docker build -f Dockerfile --platform linux/amd64 -t zap-chrome . + # The no-sandbox option does appear to be needed + docker run --rm -v "$(pwd)":/zap/wrk/:rw zap-chrome zap.sh -cmd -autorun /zap/wrk/chrome.yaml -config selenium.chromeArgs.arg.argument=--no-sandbox diff --git a/docker/chrome/Dockerfile b/docker/chrome/Dockerfile new file mode 100644 index 00000000000..4a99a439372 --- /dev/null +++ b/docker/chrome/Dockerfile @@ -0,0 +1,10 @@ +FROM --platform=linux/amd64 zaproxy/zap-nightly:latest + +USER root + +RUN apt-get update && \ + wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \ + apt-get install -y ./google-chrome-stable_current_amd64.deb && \ + rm -rf /var/lib/apt/lists/* + +USER zap \ No newline at end of file diff --git a/docker/chrome/README.md b/docker/chrome/README.md new file mode 100644 index 00000000000..1b31f940e8a --- /dev/null +++ b/docker/chrome/README.md @@ -0,0 +1,5 @@ +# Chrome Docker Test Files + +This directory contains files for testing adding Chrome to a ZAP Dokcer image, as detailed +in the FAQ: https://www.zaproxy.org/faq/how-do-i-use-chrome-with-zap-in-docker/ + diff --git a/docker/chrome/chrome.yaml b/docker/chrome/chrome.yaml new file mode 100644 index 00000000000..502b916e6a6 --- /dev/null +++ b/docker/chrome/chrome.yaml @@ -0,0 +1,25 @@ +--- +env: + contexts: + - name: "Chrome Headless Test" + urls: + - "https://demo.owasp-juice.shop" + parameters: + failOnError: true + failOnWarning: true + progressToStdout: true +jobs: +- parameters: + maxDuration: 1 + numberOfBrowsers: 1 + browserId: "chrome-headless" + tests: + - name: "At least one URL found" + onFail: "WARN" + statistic: "spiderAjax.urls.added" + site: "" + operator: ">=" + value: 20 + type: "stats" + name: "spiderAjax" + type: "spiderAjax" \ No newline at end of file