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

There are more mandatory fields required than showed in Swagger #3121

Closed
vira-vira opened this issue Oct 28, 2020 · 7 comments
Closed

There are more mandatory fields required than showed in Swagger #3121

vira-vira opened this issue Oct 28, 2020 · 7 comments

Comments

@vira-vira
Copy link

vira-vira commented Oct 28, 2020

Attempted to
Create a new issue in Defect Dojo through API v2 using the minimal parameters marked as mandatory in the documentation. We use a POST Request with the endpoint /findings/
Documentation:
http://127.0.0.1:8080/api/v2/doc/
Screenshots of Swagger:

Screen Shot 2020-10-29 at 09 16 27

Screen Shot 2020-10-29 at 09 16 49

Screen Shot 2020-10-29 at 09 17 08

Screen Shot 2020-10-29 at 09 17 25

In Swagger, it shows that the minimum mandatory fields required for a POST Request in /findings are:

  • test
  • found_by
  • title
  • severity
  • description
  • mitigation
  • impact

The expected behavior was
A 201 Created with a JSON response as stated in the docs.
We Got

500 Error

. In the server logs there is this traceback: ![image](https://user-images.githubusercontent.com/32620981/97574556-2b91dd80-19ca-11eb-9b0a-33c3c27bac49.png)

Workaround
We created POST request with the following parameters:

  • test
  • found_by
  • title
  • severity
  • description
  • mitigation
  • impact
  • numerical_severity
  • duplicate
  • verified
  • false_p
@valentijnscholten
Copy link
Member

valentijnscholten commented Jun 21, 2021

@vidhan13j07 could you check again in dev? We have fixed lots of schema inconsistencies and added an OpenAPI v3 schema as well. Actually it might be that the spec is correctly rendered based in the model fields, but the logic still assumes some extra fields to be present.

@devGregA
Copy link
Contributor

devGregA commented Jul 2, 2021

@valentijnscholten I can have this validated.

@XiChen-Tibco
Copy link
Contributor

@vira-vira Hi, could you give us more details about how to reproduce this error?

XiChen-Tibco pushed a commit to XiChen-Tibco/django-DefectDojo that referenced this issue Aug 13, 2021
…(Active and verified are required as well)
valentijnscholten pushed a commit that referenced this issue Aug 14, 2021
* Solve for issue#3121

* Solve for issue#3121, revert unnecessary changes

* Solve for issue#3121, without changing model.py

* Solve for issue#3121, also fix the conflict issue by revert unnecessary changes..

* Fix issue #3121 with necessary field for findings POST API (Active and verified are required as well)

Co-authored-by: Michael Chen <michaelchen@Michaels-MBP.attlocal.net>
Co-authored-by: Michael Chen <michaelchen@Michaels-MacBook-Pro.local>
@valentijnscholten
Copy link
Member

merged into dev / 2.2.0

@valentijnscholten
Copy link
Member

The fix turned out to be incomplete, see for example #5019

@sokayvich-git
Copy link

In /import-scan/, environment variable is not marked as required in swagger, but results in 500 errors when using the netsparker import test_type without it.

@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 17, 2022
@stale stale bot closed this as completed Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants