osv-scanner icon indicating copy to clipboard operation
osv-scanner copied to clipboard

Better error output for malformed inputs.

Open 0-wiz-0 opened this issue 2 years ago • 2 comments
trafficstars

I've created a CycloneDX SBOM JSON file using syft in the file system detection mode. I then passed it to osv-scanner 1.0.1 and got the following error message:

# osv-scanner --sbom sbom.cyclonedx.json                                                                                                                                                            
Scanned CycloneDX SBOM                                                                                                                                                                                      
scan failed server response error: {"code":3,"message":"Invalid Package URL."}    

Can you please make this error more detailed so it's clearer which Package URL is invalid?

(I think I know what the reason is; syft created 59 sections looking like this:

       "externalReferences": [
         {
           "url": "",
           "hashes": [
             {
               "alg": "SHA-1",
               "content": "SOMESHA1"
             }
           ],
           "type": "build-meta"
            }                                                                                                                                                                                                 
       ],

and one like this:

       "bom-ref": "77d4884a4c0c2f96",
       "type": "library",
       "name": "",
       "cpe": "cpe:2.3:a:python-:python-:*:*:*:*:*:*:*:*",
       "purl": "pkg:pypi/",
       "properties": [
...

when I deleted these, osv-scanner didn't report this error any longer.) (I'll file a bug report for syft next.)

0-wiz-0 avatar Dec 19 '22 20:12 0-wiz-0

This issue has not had any activity for 60 days and will be automatically closed in two weeks

github-actions[bot] avatar Jul 25 '24 18:07 github-actions[bot]

Anyone working on this?

0-wiz-0 avatar Jul 25 '24 18:07 0-wiz-0

This issue has not had any activity for 60 days and will be automatically closed in two weeks

See https://github.com/google/osv-scanner/blob/main/CONTRIBUTING.md for how to contribute a PR if you're interested in helping out.

github-actions[bot] avatar Sep 28 '24 06:09 github-actions[bot]

Thank you, @another-rex !

0-wiz-0 avatar Sep 30 '24 07:09 0-wiz-0