Filtering a rule does not work on ZAP
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 15.8k
- Forks
- 2.6k
- Avg merge
- 13h 16m
- Merged PRs (30d)
- 17
Description
Describe the bug:
Hi,
We have tried all the method explained in the user group for filtering false positive. I raised this in the user groups mentioned below. (https://groups.google.com/g/zaproxy-users/c/Md1T377l3Fs)
Steps to reproduce the behavior:
- Run ZAP via Docker using the automation framework with the following command:
docker run -v $(pwd):/zap/wrk/:rw -t zaproxy/zap-stable \
bash -c "zap.sh -addonupdate -addoninstall pscanrulesBeta \
-cmd -autorun /zap/wrk/zap-automation.yaml"
- Create an Automation Framework alertFilter job in a YAML file with the following structure:
- type: alertFilter
parameters:
deleteGlobalAlerts: false
alertFilters:
- ruleId: 10109
context: "staticapp"
newRisk: "False Positive"
url: "https://example\\.azurestaticapps\\.net/.*"
urlRegex: true
methods: [GET]
- ruleId: 10017
context: "staticapp"
newRisk: "False Positive"
url: "https://example\\.azurestaticapps\\.net/.*"
urlRegex: true
methods: [GET]
- ruleId: 10015
context: "staticapp"
newRisk: "False Positive"
url: "https://example\\.azurestaticapps\\.net/.*"
urlRegex: true
methods: [GET]
-
Merge the alertFilter YAML into the main automation plan so filters run
before the spider and scan jobs. -
Pass the merged automation plan to ZAP using -autorun.
-
Inspect the generated zap-scan-report.json.
-
Observe that alerts for rule IDs 10109, 10017, 10015 (and others declared
in the alertFilter job) are still present in the report with their original
risk level — they are NOT reclassified as "False Positive".
Expected behavior:
Alerts matching all of the following criteria defined in the alertFilter job
should be reclassified as "False Positive" in the scan report and excluded
from the findings count:
- ruleId matches a declared alertFilter entry (e.g. 10109, 10017, 10015)
- URL matches the regex pattern declared under
urlwithurlRegex: true - HTTP method matches a method declared under
methods - Context matches the declared context name
The generated report (zap-scan-report.json / .xml / .html) should reflect the
reclassified risk level of "False Positive" for all matching alerts, and those
alerts should not contribute to the high/medium/low finding counts used to
gate the pipeline.
Software Versions:
Docker 29.2.1
Zap latest version
Screenshots:
No response
Errors from the zap.log file:
No response
Additional context:
No response
Would you like to help fix this issue?
- Yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue through the -autorun entry point using the alertFilter job in zap-automation.yaml. Compare zap-scan-report.json with the expected rule IDs, URL, method, context, risk, and finding counts. Done means matching alerts are reclassified as False Positive and excluded from the report counts; no source file or test is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- devops, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100