Skip to content
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

create_finding error : found_by field is required #60

Open
vishnupriyaavp8 opened this issue Nov 9, 2021 · 2 comments
Open

create_finding error : found_by field is required #60

vishnupriyaavp8 opened this issue Nov 9, 2021 · 2 comments

Comments

@vishnupriyaavp8
Copy link

vishnupriyaavp8 commented Nov 9, 2021

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)>}
@fuzzah
Copy link

fuzzah commented Nov 11, 2021

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].

@valentijnscholten
Copy link
Member

Sounds like you could make a small PR that we can merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants