-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alertFilter documentation could use some clarification #88
Comments
The URL in the command doesn't match the URL is the screenshot. Note the "new2" portion, also the blacked out portion seems to be much longer than simply |
As i wrote, i had to mask it because it's a real url that i'm testing here. So i can ensure that the URL is matching ;) |
Did you check what is ZAP receiving? |
I was able to recreate this. I added a Global Filter via the API (with ZAP running in GUI mode) and it didn't apply (even after refreshing the Alerts tree). If I went into Options and Modify > Test it would match 1 alert (as I expected). When I applied from the Modify screen then the alert was actually updated. Edit: I didn't test reporting. |
The problem is how i can access options etc from docker, should i set something with -config? |
I didn't quite understood the question but the connection ci-zap is working. I get the report and i can send the curl request to set the filter and by doing a query, i got the filter back with my inputs. So ZAP is receiving my commands and traffic correctly |
You can use the API view |
as you see from the second screen, the filter is set |
@psiinon @thc202 I believe in this block: https://github.com/zaproxy/zap-extensions/blob/54417192ee6ea0d92cd60fdf7c1ebc1c90bac2fe/addOns/alertFilters/src/main/java/org/zaproxy/zap/extension/alertFilters/AlertFilterAPI.java#L249-L274 at either 266/267 or 268/269 this needs to do a Do you agree? |
Yeh, def worth trying - good spot |
Aren't the alert filters supposed to be applied to new alerts? Maybe add a parameter or a new endpoint, to keep the expected behaviour. |
thats true, the API wasnt intended to support applying them to existing alerts, although it could be extended to do so |
Okay I'll add an |
But that wont solve this issue will it? If the filter is being correctly applied before the alerts are raised then it will make no difference... |
Will have to test further. |
Okay so yeah, I'm not able to confirm the original report. If the details actually match properly the filter is applied if it's in place first. |
@mdem99 I only see a few options
|
I will try asap. |
I've split the apply thing into another ticket. It's a nice to have it's not really applicable here. If you're creating the filters before the alerts they should apply just fine. To be clear when I was saying run ZAP in GUI mode you can still "drive" it via the API. So that way you'd see how your curl command(s) are working out.
Sorry I'm working and checking in here, so apparently I fail at multitasking and retaining details today 🤷 |
No prob :) I'm also working in parallel with GUI (ZAP application for Windows). There i can apply the filter after the "report" creation, or let's say after we got the alerts listed down. Again, working with for example with the GUI (ZAP application for Windows), works. Just to be sure, i'm running ZAP as a Service in the Pipeline, could this have any impact to the filter/report creation? Is there any other kind of information that i can provide you? Thank you again! |
Hello everyone, I wanted to know if there are any news regarding this topic. I performed, with my team, all the necessary tests (Daemon in pipeline, API UI and GUI) without any result. As far as I'm concerned, the filter should work as it is. I noticed a guy had the same problem a while ago and it was never cleared up. I also noticed that he solved the problem himself by writing a parser for the html-report file and applying a filter himself. Can we find another solution or will I have to find another workaround too? Thank you very much! |
That's not the same problem unless you are also adding the filters after the alerts are raised. I'd suggest checking with an API request that there are no alerts already raised before adding the filter. |
I agree with you but i think the similarity is interesting. In that case the filter was also not working and his solutions shows that he had to find another workaround. |
I managed to get the filter working :) So, a couple of very important things that in my opinion, should be added to the documentation:
These findigs have required weeks of research and testing, because of the absence of documentation and/or examples. I hope this can help new users to solve the problem and I ask instead to you developers the possibility to report everything in the documentation. Thanks anyway for your assistance and your time! ZAP is and remains the best tool :) |
@mdem99 thanks for following up. Glad you got it sorted out. |
Transferred issue to api docs repo, re-opening. In particular #88 (comment) should be addressed. |
Shouldn't the changes (if any) be done in the Alert Filters add-on? |
Oh, I guess. I was thinking here mainly because of the comments around curl examples needing to be more clear/specific |
OK, thought this was specifically about the Alert Filters. In that case it applies to all (cURL) examples (e.g. need to escape/encode, enable, use proper values). |
Describe the bug
The ZAP daemon analyzes traffic from contract tests in the pipeline and produces a report. We are getting some "false positives" or defects that are already in WIP and would like to declassify them to informational threats.
The alert filter gives a "request: ok" but the filter is not afting the report in any way, ergo, it is not working.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The alert filter should impact the results of the report and reclassify a threat. In my case, I wanted to classify this threat as False Positive.
The request (with fake URL):
curl -X -4 --retry 2 --retry-connrefused --retry-delay 3 http://zap:8090/JSON/alertFilter/action/addGlobalAlertFilter/?ruleId=10098\&newLevel=-1\&url=https%3A%2F%2Famazonaws.com%2Fapi%2Fv1%2Fpings\¶meter=Cache-Control\&enabled=true\&evidence=
Screenshots
Software versions
Errors from zap.log file
The zap.log file is not accessible. Reason. I don't have a personal Docker coitaniner running, but I'm pulling a new image every time (since I'm using it a service).
For debugging I am using
config "api.incerrordetails=true"
.Additional context
My findings:
**Would you like to help solve this problem?
This seems to be a really strange behavior and it would be very important for me to get it working, so yes, I would also like to help if I can.
The text was updated successfully, but these errors were encountered: