Repository navigation
Parameter confidence is optional and CWE's are not always numerical in GitLab SAST - #3567
Conversation
|
I just reviewed your modification and I have 2 comments here:
scanner_confidence = vuln.get('confidence'], 'Unknown')It seems that the default value is scanner_confidence = Finding.get_number_severity(vuln['confidence'])see here |
|
Also, @StefanFl could you add another report and keep the old one? Could be good to have the report that makes you exceptions. |
damiencarol
left a comment
There was a problem hiding this comment.
See my previous comments. Some modifications could be different.
| scanner_confidence = Finding.get_number_severity(vuln['confidence']) | ||
| scanner_confidence = None | ||
| if 'confidence' in vuln: | ||
| scanner_confidence = Finding.get_number_severity(vuln['confidence']) |
There was a problem hiding this comment.
| scanner_confidence = Finding.get_number_severity(vuln['confidence']) | |
| scanner_confidence = vuln.get('confidence', 'Unknown') |
|
@damiencarol GitLab has 2 different scanners. GitLab SAST is static code analysis (the parser of this PR), while the PR you have referenced parses the results of the GitLab Dependency Scanner. File format for these 2 scanners seems to be pretty similar. Thank you for the review, will change the files according to your suggestions. |
|
Interesting one, it was definitely a bug. GitLab SAST can produce a confidence, but the values (search for confidence in https://docs.gitlab.com/ce/development/integrations/secure.html) need to be mapped to the values understood by DefectDojo (see The new report is an amended excerpt from findings for the OWASP Juice Shop, I think this should be allowed. |
|
Please wait with the review, I think there is another problem with these reports |
|
Take your time and happy new year!
|
|
All values are mapped apart from `
For the others see the method |
|
A further test showed, that GitLab sometimes writes non-numerical CWE's which can not be stored in the database. There is a fix for it as well now including a new test case. Please re-review the whole PR, thank you. |
damiencarol
left a comment
There was a problem hiding this comment.
LGTM, high quality modification, this will make Gitlab SAST parser more robust!
One minor feedback, you could have used the feature of subtests to check the items in the unit tests: https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests
|
@valentijnscholten @madchap it's ready for review. |
|
@StefanFl why did you closed this PR ? |
|
Oops, that wasn't intended, thanks @damiencarol for notifying me. |
madchap
left a comment
There was a problem hiding this comment.
good job @StefanFl and thanks for the tight review @damiencarol :)
GitLab SAST doesn't always set the parameter
confidencefor a vulnerability, leading to an exception when importing the vulnerabilities.