Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ RUN useradd -u 1000 -m -s /bin/bash zap && \
# Switch to non-root for runtime
USER zap

# Ensure the workspace directory exists and is owned by our zap user
RUN mkdir -p /zap/wrk \
&& chown -R zap:zap /zap/wrk
# Declare it as a volume so runtimes can mount it
VOLUME ["/zap/wrk"]
# Configure environment for ZAP
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 \
PATH=${JAVA_HOME}/bin:/zap:${PATH} \
Expand Down
9 changes: 4 additions & 5 deletions ci/tasks/zap-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ inputs:

outputs:
- name: zap-report
dir-path: /zap/wrk

params:
TARGET_CONTEXT: # one of internal, external, pages, unauthenticated
Expand Down Expand Up @@ -46,13 +47,11 @@ run:
CLIENT_SECRET=$(jq -r --arg ctx "$TARGET_CONTEXT" '.[$ctx].client_secret // empty' <<<"$CREDS_JSON")
TOKEN_URI=$(jq -r --arg ctx "$TARGET_CONTEXT" '.[$ctx].token_uri // empty' <<<"$CREDS_JSON")

mkdir -p zap-report

for url in "${URLS[@]}"; do
host=$(echo "$url" | sed -E 's#https?://##;s#/.*##')
HTML_OUT="zap-report/${TARGET_CONTEXT}-${host}.html"
JSON_OUT="zap-report/${TARGET_CONTEXT}-${host}.json"
XML_OUT="zap-report/${TARGET_CONTEXT}-${host}.xml"
HTML_OUT="/zap/wrk/${TARGET_CONTEXT}-${host}.html"
JSON_OUT="/zap/wrk/${TARGET_CONTEXT}-${host}.json"
XML_OUT="/zap/wrk/${TARGET_CONTEXT}-${host}.xml"

echo "→ Scanning $url"

Expand Down
10 changes: 5 additions & 5 deletions ci/zap-config/zap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- type: report
parameters:
template: "traditional-html"
reportDir: "zap-report"
reportDir: "/zap/wrk"
reportFile: "{{yyyy-MM-dd}}-[[site]]-html.html"
displayReport: false
risks:
Expand All @@ -47,7 +47,7 @@ jobs:
- type: report
parameters:
template: "traditional-json"
reportDir: "zap-report"
reportDir: "/zap/wrk"
reportFile: "{{yyyy-MM-dd}}-[[site]]-json.json"
displayReport: false
risks:
Expand All @@ -64,7 +64,7 @@ jobs:
- type: report
parameters:
template: "traditional-xml"
reportDir: "zap-report"
reportDir: "/zap/wrk"
reportFile: "{{yyyy-MM-dd}}-[[site]]-xml.xml"
displayReport: false
risks:
Expand All @@ -77,11 +77,11 @@ jobs:
- medium
# - low
# - falsepositive

- type: report
parameters:
template: "sarif-json"
reportDir: "zap-report"
reportDir: "/zap/wrk"
reportFile: "{{yyyy-MM-dd}}-[[site]]-sarif.sarif.json"
displayReport: false
risks:
Expand Down