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
11 changes: 8 additions & 3 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ jobs:

- get: zap-runner
trigger: true
passed: [set-self]
passed:
- set-self

- across:
- var: context
values: ["internal", "external", "pages", "unauthenticated"]
limit: all
values:
- "internal"
- "external"
- "pages"
- "unauthenticated"
max_in_flight: all
fail_fast: false
do:
- task: zap-scan
Expand Down
6 changes: 3 additions & 3 deletions ci/tasks/zap-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ outputs:
params:
TARGET_CONTEXT: # one of internal, external, pages, unauthenticated
CREDHB_CRED: # JSON with all context credentials
repo_name:
runner_tag:

run:
path: bash
Expand All @@ -34,16 +32,18 @@ run:

CREDS_JSON="$CREDHB_CRED"

# Filter URLs for this context
mapfile -t URLS < <(
tail -n +2 ci/zap-config/urls.csv | \
awk -F',' -v ctx="$TARGET_CONTEXT" '$1==ctx {print $2}'
awk -F',' -v ctx="$TARGET_CONTEXT" '$1==ctx { print $2 }'
)

if [ ${#URLS[@]} -eq 0 ]; then
echo "No URLs for context '$TARGET_CONTEXT', skipping."
exit 0
fi

# Extract credentials for this context
CLIENT_ID=$(jq -r --arg ctx "$TARGET_CONTEXT" '.[$ctx].client_id' <<<"$CREDS_JSON")
CLIENT_SECRET=$(jq -r --arg ctx "$TARGET_CONTEXT" '.[$ctx].client_secret' <<<"$CREDS_JSON")
TOKEN_URI=$(jq -r --arg ctx "$TARGET_CONTEXT" '.[$ctx].token_uri' <<<"$CREDS_JSON")
Expand Down