'defect dojo import scan fails with 400 error code

Running defect dojo instance in kubernetes environment and doing curl operation to import scan of nessus results and is failing with 400.I have the excat same code running in different environment and there import is working fine with same scan file.

curl -v -s -o $http_response -w "%{http_code}" -X POST  -H  "accept: */*" -H  "Content-Type: multipart/form-data" -F "file=@filename;type=text/xml" $DEFECTDOJO_API_URL/engagements/29/import-scan

output of the curl trace as below

3940: .</ReportItem>.</ReportHost>.</Report>.</NessusClientData_v2>.
=> Send data, 48 bytes (0x30)
0000:
0002: --------------------------b2766f621eee7af1--
<= Recv header, 26 bytes (0x1a)
0000: HTTP/1.1 400 Bad Request
<= Recv header, 20 bytes (0x14)
0000: content-length: 98
<= Recv header, 40 bytes (0x28)
0000: content-type: application/problem+json
<= Recv header, 37 bytes (0x25)
0000: date: Tue, 01 Feb 2022 14:17:36 GMT
<= Recv header, 21 bytes (0x15)
0000: server: istio-envoy
<= Recv header, 37 bytes (0x25)
0000: x-envoy-upstream-service-time: 5857
== Info: HTTP error before end of send, stop sending
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 98 bytes (0x62)
0000: {. "detail": "Bad Request",. "status": 400,. "title": "Bad Re
0040: quest",. "type": "about:blank".}.
== Info: Closing connection 0

Not able to find the root cause of this 400 error. I doubled checked the nessus report file and is valid xml file



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source