vulnerablecode icon indicating copy to clipboard operation
vulnerablecode copied to clipboard

API fixed_packages issues

Open pombredanne opened this issue 3 years ago • 2 comments

from @tdruez

The current implementation of the fixed_packages on the package endpoint is not convient for the data consumer:

{
    'purl': 'pkg:npm/%40theia/[email protected]',
    'affected_by_vulnerabilities': [{
        'summary': 'Insufficient Verification of Data Authenticity',
        'vulnerability_id': 'VULCOID-AWK',
     }],
    'fixed_packages': [{
        'fixing_vulnerabilities': [{
            'url': 'http://public.vulnerablecode.io/api/vulnerabilities/14132?format=json',
            'vulnerability_id': 'VULCOID-AWK',
        }],
        'purl': 'pkg:npm/%40theia/[email protected]',
        'url': 'http://public.vulnerablecode.io/api/packages/136169?format=json',
    }],
}

To make use of this data, one has to reconcile both affected_by_vulnerabilities and fixed_packages data structure through the vulnerability_id. This make the data hard to use for display.

A better way would be to include the fixed_packages in the affected_by_vulnerabilities data structure (which seems to be the current implementation on the vulnerabilities endpoint), such as:

{
    'purl': 'pkg:npm/%40theia/[email protected]',
    'affected_by_vulnerabilities': [{
        'summary': 'Insufficient Verification of Data Authenticity',
        'vulnerability_id': 'VULCOID-AWK',
        'fixed_packages': [{
            'purl': 'pkg:npm/%40theia/[email protected]',
            'url': 'http://public.vulnerablecode.io/api/packages/136169?format=json',
        }],
    }],
}

@TG1999 any thoughts on this?

pombredanne avatar Jul 26 '22 15:07 pombredanne

This would be for a V2 of the API that will come in V31 milestone .... See also #810

pombredanne avatar Aug 02 '22 16:08 pombredanne

As per discussion with @tdruez we can have this change in this version of the API.

TG1999 avatar Aug 07 '22 20:08 TG1999