defectdojo_api
defectdojo_api copied to clipboard
create_finding error : found_by field is required
Bug Description
create_finding() method gives error "found_by field is required"
Steps to reproduce
Code :
from defectdojo_api.defectdojo_api import defectdojo_apiv2
host = 'http://localhost:8080/'
api_key = 'xxxx..xxxx'
user = 'User1'
dd = defectdojo_apiv2.DefectDojoAPIv2(host, api_key, user, debug=False)
res = dd.create_finding(title = 'Test8', description = 'Test', severity = 'Critical', cwe = 3, date = '2021-11-09',
product_id = 12, engagement_id = 25, test_id = 47, user_id = 8, impact = 'Test',
active = True, verified = False, mitigation = 'Test', numerical_severity='S0')
print(res.__dict__)
Output :
{'message': 'Error occured in API.',
'data': '{"found_by":["This field is required."],"message":"{\'found_by\': [ErrorDetail(string=\'This field is required.\', code=\'required\')]}"}',
'success': False,
'response_code': 400,
'logger': <Logger defectdojo_api (WARNING)>}
Hello!
As a temporary solution you can create your own DD api class inherited from DefectDojoAPIv2 and override its create_finding method to accept test_type_id argument.
Implementation should be the same as in original method, but you need to append data dictionary with key-value pair "found_by": [test_type_id].
Sounds like you could make a small PR that we can merge?