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
This PR has removed the default value of the file parameter.
So when importing a scan without providing file parameter (using the api_scan_configuration), the process fails with
the following error:
ERROR [dojo.api_v2.exception_handler:48] 'file'
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rest_framework/mixins.py", line 19, in create
self.perform_create(serializer)
File "/app/dojo/api_v2/views.py", line 2517, in perform_create
serializer.save(push_to_jira=push_to_jira)
File "/app/dojo/api_v2/serializers.py", line 2406, in save
context = self.set_context(data)
^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/api_v2/serializers.py", line 2375, in set_context
context = self.setup_common_context(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/api_v2/serializers.py", line 2289, in setup_common_context
context["scan"] = data.pop("file")
^^^^^^^^^^^^^^^^
KeyError: 'file'
Steps to Reproduce:
Call the API /api/v2/import-scan to import a scan without including file parameter.
The API returns with status 500.
Expected Behavior:
The file parameter is optional, so the API should handle cases where it is not provided gracefully.
Actual Behavior:
The API throws a KeyError when the file parameter is missing.
Additional Context:
This behavior started in version 2.41.0.
It was working correctly in previous versions where the file parameter had a default:
This PR has removed the default value of the
file
parameter.So when importing a scan without providing
file
parameter (using theapi_scan_configuration
), the process fails withthe following error:
Steps to Reproduce:
/api/v2/import-scan
to import a scan without includingfile
parameter.Expected Behavior:
The
file
parameter is optional, so the API should handle cases where it is not provided gracefully.Actual Behavior:
The API throws a KeyError when the
file
parameter is missing.Additional Context:
django-DefectDojo/dojo/api_v2/serializers.py
Line 2206 in 6d847ab
The text was updated successfully, but these errors were encountered: