Repository navigation
Add the close_old_findings parameter also to reimport API - #3572
Conversation
|
lgtm, especially as this does not change the current behavior and allows for more flexibility. |
|
Please keep UI and API logic in sync. |
@valentijnscholten what exactly do you mean by this? Can you provide some pointer to the UI part which is out of sync? |
Please have a look at https://github.com/DefectDojo/django-DefectDojo/blob/dev/dojo/test/views.py#L618 |
|
@valentijnscholten @madchap I added it the |
|
Thanks. Sorry if my remarks was not clear, but unfortunately currently the reimport logic is duplicated in two places (and slighly different). We want to refactor this at some point, which makes it even more important to make sure the behaviour is covered by the unit tests or integration tests. Could you update the existing tests around import/reimport in Also, to have the new boolean appear on the form, it would need to be added to ReImportScanForm in |
valentijnscholten
left a comment
There was a problem hiding this comment.
see previous comment
|
@valentijnscholten I added the field into the form and also added a test to validate the reimport of old findings without closing them. |
|
The number of notes also changes when closing or not closing findings. Also you probably can use the existing sample files as there is already 1 or more testcases testing the reimport with some findings no longer in the report. |
…m to keep the functionality in sync with the API
3669224 to
62a0f05
Compare
Signed-off-by: Cosmin Cojocar <ccojocar@cloudbees.com>
|
@valentijnscholten I reworked the unit test following your comments and it is now green. Please have a look if you are happy with the current implementation. Thanks! |
…#3572) * Add the close_old_findings parameter also to reimport API * Introduce the close_old_findings as a parameter into the reimport form to keep the functionality in sync with the API * Add the close_old_findings field to ReImportScanForm * Add test to validate the reimport of findings without closing old findings
Add the
close_old_findingsparameter toreimportAPI similarly like forimportAPI. This param will control if the old findings are going to be mitigated or not. The change maintains the current behaviour by mitigating the old findings if no parameter is set in the reimport API request.The reason for this change, it is triggered by one of our use cases where some git repositories are continuously scanned for secrets. After the initial scan, when the entire commits history is checked, the scanner goes over the commits only from the last 2 days. This generates just a diff of findings which when they get reimported leads to the mitigation of all other findings. Obviously those findings are not yet mitigated. That being said, we want to control when the old findings are mitigated by the reimport command.
cc @madchap @yilmi