Hey all, I'm new to the group but have been using zaproxy for a long time and really like the product. Lately, we've been having issues using automation plans in which sites which are not in context are reported in the HTML report as well as the sitemap output. I've scanned the web and this group, but have not found a solution as of yet-
Inside of my automation plan, I have the following context set up:
env:
contexts:
- name: Default Context
urls:
- "https://${TARGET}"
excludePaths:
- "(?!.*\\.${TARGET}).*" # Are negative lookaheads supported?
- ".*\\.(png|jpeg|jpg|gif|svg|ico|woff|woff2|ttf|css|js)$" # Don't attack static files
Afterwards, we do the following:
- name: Export Site Tree
type: export
parameters:
context: Default Context
type: yaml
source: sitestree
fileName: reports/${REPORT_NAME}-sitestree.yaml
- name: Prune Site Tree
type: prune
parameters:
fileName: reports/${REPORT_NAME}-sitestree.yaml
And finally,
- name: Generate HTML Report
type: report
parameters:
template: modern
theme: corporate
reportDir: reports
reportFile: ${REPORT_NAME}.html
reportTitle: ZAP Security Scan Report
reportDescription: Security scan results for ${TARGET}
includedRisks:
- High
- Medium
sites:
- ${TARGET}
So, ideally we could have a situation in which this outputs a report only covering our TLD ($TARGET.com), and any subdomains that are not explicitly denied (abc.$TARGET.com), as well as the explicitly denied file types. Instead, we receive the following output (I edited the HTML for privacy)

Has anyone dealt with an issue such as this? How can I more closely define the scope? TIA!
Peter