scanners/zap-advanced/examples/demo-petstoreapi-scan-authenticated/scan.yaml
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0
---
apiVersion: v1
kind: ConfigMap
metadata:
name: zap-advanced-scan-config
data:
2-zap-advanced-scan.yaml: |-
global:
# Sets the ZAP Session name
sessionName: integration-test
# Configures existings ZAP Scripts or add new ZAP Scripts.
scripts:
- name: "Alert_on_HTTP_Response_Code_Errors.js"
enabled: true
filePath: "/home/zap/.ZAP_D/scripts/scripts/httpsender/Alert_on_HTTP_Response_Code_Errors.js"
engine: "Oracle Nashorn"
type: "httpsender"
description: "A HTTP Sender Script which will raise alerts based on HTTP Response codes."
- name: "Alert_on_Unexpected_Content_Types.js"
enabled: true
filePath: "/home/zap/.ZAP_D/scripts/scripts/httpsender/Alert_on_Unexpected_Content_Types.js"
engine: "Oracle Nashorn"
type: "httpsender"
description: "A HTTP Sender Script which will raise alerts based on unexpected Content-Types."
# ZAP Contexts Configuration
contexts:
# Name to be used to refer to this context in other jobs, mandatory
- name: scb-petstore-context
# The top level url, mandatory, everything under this will be included. IMPORTANT: must be the hostname without any subpath!
url: http://petstore.demo-targets.svc/
# An optional list of regexes to include
includePaths:
- "http://petstore.demo-targets.svc/v2.*"
# An optional list of regexes to exclude
excludePaths:
- ".*\\.css"
- ".*\\.png"
- ".*\\.jpeg"
apis:
- name: scb-petstore-api
# -- The Name of the context (zapConfiguration.contexts[x].name) to spider, default: first context available.
context: scb-petstore-context
# -- format of the API ('openapi', 'grapql', 'soap')
format: openapi
# -- Url to start spidering from, default: first context URL
url: http://petstore.demo-targets.svc/v2/swagger.json
# -- Override host setting in swagger.json
hostOverride: http://petstore.demo-targets.svc
# ZAP Spiders Configuration
spiders:
- name: scb-petstore-spider
# String: Name of the context to spider, default: first context
context: scb-petstore-context
# String: Url to start spidering from, default: first context URL
url: http://petstore.demo-targets.svc/v2/
# Int: Fail if spider finds less than the specified number of URLs, default: 0
failIfFoundUrlsLessThan: 0
# Int: Warn if spider finds less than the specified number of URLs, default: 0
warnIfFoundUrlsLessThan: 0
# Int: The max time in minutes the spider will be allowed to run for, default: 0 unlimited
maxDuration: 1
# Int: The maximum tree depth to explore, default 5
maxDepth: 5
# Int: The maximum number of children to add to each node in the tree
maxChildren: 10
# Bool: Whether the spider will accept cookies, default: true
acceptCookies: true
# Bool: Whether the spider will parse HTML comments in order to find URLs, default: true
parseComments: true
# Bool: Whether the spider will parse Git metadata in order to find URLs, default: false
parseGit: false
# Bool: Whether the spider will parse 'robots.txt' files in order to find URLs, default: true
parseRobotsTxt: false
# Bool: Whether the spider will parse 'sitemap.xml' files in order to find URLs, default: true
parseSitemapXml: false
# Bool: Whether the spider will parse SVN metadata in order to find URLs, default: false
parseSVNEntries: false
# Bool: Whether the spider will submit POST forms, default: true
postForm: true
# Bool: Whether the spider will process forms, default: true
processForm: true
# Int: The time between the requests sent to a server in milliseconds, default: 200
requestWaitTime: 200
# Bool: Whether the spider will send the referer header, default: true
sendRefererHeader: true
# Int: The number of spider threads, default: 2
threadCount: 2
# String: The user agent to use in requests, default: '' - use the default ZAP one
userAgent: "secureCodeBox / ZAP Spider"
# ZAP ActiveScans Configuration
scanners:
- name: scb-petstore-scan
# String: Name of the context to attack, default: first context
context: scb-petstore-context
# String: Url to start scaning from, default: first context URL
url: http://petstore.demo-targets.svc/v2/
# String: Name of the scan policy to be used, default: Default Policy
policy: "API-Minimal"
# Int: The max time in minutes any individual rule will be allowed to run for, default: 0 unlimited
maxRuleDurationInMins: 1
# Int: The max time in minutes the active scanner will be allowed to run for, default: 0 unlimited
maxScanDurationInMins: 5
# Int: The max number of threads per host, default: 2
threadPerHost: 5
# Int: The delay in milliseconds between each request, use to reduce the strain on the target, default 0
delayInMs: 0
# Bool: If set will add an extra query parameter to requests that do not have one, default: false
addQueryParam: false
# Bool: If set then automatically handle anti CSRF tokens, default: false
handleAntiCSRFTokens: false
# Bool: If set then the relevant rule Id will be injected into the X-ZAP-Scan-ID header of each request, default: false
injectPluginIdInHeader: false
# Bool: If set then the headers of requests that do not include any parameters will be scanned, default: false
scanHeadersAllRequests: false
---
apiVersion: "execution.securecodebox.io/v1"
kind: Scan
metadata:
name: "zap-advanced-api-scan-petstore"
spec:
scanType: "zap-advanced-scan"
parameters:
# target URL including the protocol
- "-t"
- "http://petstore.demo-targets.svc/"
volumeMounts:
- name: zap-advanced-scan-config
mountPath: /home/securecodebox/configs/2-zap-advanced-scan.yaml
subPath: 2-zap-advanced-scan.yaml
readOnly: true
volumes:
- name: zap-advanced-scan-config
configMap:
name: zap-advanced-scan-config