You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Retrieve DefectDojo finding ID from SecureCodeBox finding ID #536
As a secureCodeBox user with DefectDojo integration I would like to know what DefectDojo finding was created for each secureCodeBox finding (and vice-versa).
This would be useful in a case where you create a custom hook which sends notifications for very specific finding cases with a link to the DefectDojo finding. DefectDojo's notification support is very limited.
Possible solutions
These are some possible solutions that I came up with. I'm very happy to hear any other solutions!
It would make sense if the unique_id_from_tool field in the Finding model refers to SecureCodeBox's finding ID. Currently, however, the finding filters don't include this field yet (i.e. no way to get finding from the unique_id_from_tool field). This field is already updated with DefectDojo's generic importer, but some other existing importers write their own unique id into it. We would need to patch the created findings after creation.
The DefectDojo persistence provider updates the Minio finding so that it includes the DefectDojo finding ID.
The DefectDojo persistence provider is a ReadAndWriteHook which writes a map of SecureCodeBox ID -> DefectDojo ID back to the scan spec.
If I'm not getting it wrong - the defectdojo hook is already implemented as ReadWriteHook and comes with the "two way sync" feature:
defectdojo:
# -- Syncs back (two way sync) all imported findings from DefectDojo to SCB Findings Store, set to false to only import the findings to DefectDojo (one way sync).syncFindingsBack: true
Ah very cool. Just checked the source code and it seems like this is exactly the information that I requested! Maybe it's a good idea to add an example of the synced findings into the documentation.
I has turned this off by default because it was conflicting with the Cascading Hook. Does that sound familiar? I'll test some more on Monday and post logs if I can't get it to work!
Hi Robert, sorry for the delay. I've tested a bit and found the issue. Below you can find the findings for an nmap scan, one with syncFindingsBack and enabled and one with it disabled. The reason why syncFindingsBack is conflicting with Cascading Scans is because the DefectDojo persistence provider is overwriting fields that are being matched in the Cascading Rules.
This behavior results in no Cascading Rules being matched and thus no new scans starting. Would it be possible to update syncFindingsBack in such a way that it does not affect original finding fields (i.e. only add fields/attributes)?
Furthermore, you might notice that the nmap host finding disappears. I assume this is because DefectDojo only imports it as an endpoint. However, I might still like to match cascading rules to that host finding (i.e. syncFindingsBack should not discard findings).
Thanks for the detailed report and examples, much appreciated 🙏
Really merging the secureCodeBox findings and DefectDojo findings is unfortunately so hard that its as good as impossible. At least I haven't come up with a good way to do it. The parsers are just (or can be depending on the scanner) to different to reliably correlate between the two. This is especially hard when the secureCodeBox and DefectDojo will even produce a different number of findings per report, like for the host findings in DefectDojo.
One thing which might be possible to do is to configure the DefectDojo exporter to always use the Generic Finding upload (added with #487) for all findings. Then we could easily map between DefectDojo and secureCodeBox findings as they are guaranteed to be "mappable".
This might impact DefectDojo ability to properly detect duplicates & false positives thought, as DefectDojo would not know anymore which scanner specific fields are best to use to detect duplicate findings
I understand. Using the generic parser would really be less than ideal since DefectDojo's built-in parsers make a huge difference for their user-experience.
What about importing secureCodeBox findings one-by-one into DefectDojo? This way you are guaranteed a mapping (unless DefectDojo does not create a finding). I'm curious how much, if any, influence this method would have on the import duration.
I don't think that will be possible, as this would require that our DefectDojo exporter code would have to split up the raw results (e.g. the XML Output from nmap) into multiple raw results which all only contain one finding. This would be extremely complicated and would have to be tied to every scanner.
Closing this as I don't see how we can do this without a huge amount of effort on our side for each scanner, or severly decreasing the quality of findings in DefectDojo.
Activity
rfelber commentedon Jul 2, 2021
Hi @EndPositive,
thx for your proposal :)
If I'm not getting it wrong - the defectdojo hook is already implemented as ReadWriteHook and comes with the "two way sync" feature:
Have you tried this already?
Was implemented here #330
EndPositive commentedon Jul 3, 2021
Ah very cool. Just checked the source code and it seems like this is exactly the information that I requested! Maybe it's a good idea to add an example of the synced findings into the documentation.
I has turned this off by default because it was conflicting with the Cascading Hook. Does that sound familiar? I'll test some more on Monday and post logs if I can't get it to work!
EndPositive commentedon Jul 7, 2021
Hi Robert, sorry for the delay. I've tested a bit and found the issue. Below you can find the findings for an nmap scan, one with syncFindingsBack and enabled and one with it disabled. The reason why syncFindingsBack is conflicting with Cascading Scans is because the DefectDojo persistence provider is overwriting fields that are being matched in the Cascading Rules.
This behavior results in no Cascading Rules being matched and thus no new scans starting. Would it be possible to update syncFindingsBack in such a way that it does not affect original finding fields (i.e. only add fields/attributes)?
Furthermore, you might notice that the nmap host finding disappears. I assume this is because DefectDojo only imports it as an endpoint. However, I might still like to match cascading rules to that host finding (i.e. syncFindingsBack should not discard findings).
With syncFindingsBack enabled:
With syncFindinsBack disabled:
J12934 commentedon Jul 9, 2021
Hi again 👋
Thanks for the detailed report and examples, much appreciated 🙏
Really merging the secureCodeBox findings and DefectDojo findings is unfortunately so hard that its as good as impossible. At least I haven't come up with a good way to do it. The parsers are just (or can be depending on the scanner) to different to reliably correlate between the two. This is especially hard when the secureCodeBox and DefectDojo will even produce a different number of findings per report, like for the host findings in DefectDojo.
One thing which might be possible to do is to configure the DefectDojo exporter to always use the Generic Finding upload (added with #487) for all findings. Then we could easily map between DefectDojo and secureCodeBox findings as they are guaranteed to be "mappable".
This might impact DefectDojo ability to properly detect duplicates & false positives thought, as DefectDojo would not know anymore which scanner specific fields are best to use to detect duplicate findings
EndPositive commentedon Jul 12, 2021
I understand. Using the generic parser would really be less than ideal since DefectDojo's built-in parsers make a huge difference for their user-experience.
What about importing secureCodeBox findings one-by-one into DefectDojo? This way you are guaranteed a mapping (unless DefectDojo does not create a finding). I'm curious how much, if any, influence this method would have on the import duration.
J12934 commentedon Jul 13, 2021
I don't think that will be possible, as this would require that our DefectDojo exporter code would have to split up the raw results (e.g. the XML Output from nmap) into multiple raw results which all only contain one finding. This would be extremely complicated and would have to be tied to every scanner.
J12934 commentedon Jul 20, 2023
Closing this as I don't see how we can do this without a huge amount of effort on our side for each scanner, or severly decreasing the quality of findings in DefectDojo.