aquasecurity / harbor-scanner-trivy

Use Trivy as a plug-in vulnerability scanner in the Harbor registry
https://goharbor.io
Apache License 2.0
218 stars 77 forks source link

/api/v1/scan/{scan_request_id}/report should send http 400 when the sbom_media_type is missed for sbom scan #444

Open stonezdj opened 8 months ago

stonezdj commented 8 months ago

What steps did you take and what happened:

After send a SBOM request to /api/v1/scan and the subsequent request to retrieve the sbom GET /api/v1/scan/{scan_request_id}/report?sbom_media_type=xxxx, if the sbom_media_type is missed in the parameter Current return code is 404 not found.

What did you expect to happen:

The API should return 400 to the client and also log the error message in the trivy.log so that user could diagnostic the current issue, the error message should like that: the sbom_media_type is missed for sbom scan report

Environment:

knqyf263 commented 8 months ago

Fixed in https://github.com/aquasecurity/harbor-scanner-trivy/pull/422/commits/f9211e606746bbfed328f5994108cdf26285b29c