RedHatProductSecurity / cvelib

A Python library and command line interface for CVE Services.
MIT License
52 stars 24 forks source link

Bug if user has no name #40

Closed iamamoose closed 1 year ago

iamamoose commented 1 year ago

In 1.0.0 if a user has no name then you get a traceback in print_user/get_full_name name_data = user_data["name"] KeyError: 'name'

cve -a XX -u mjc@apache.org -o apache user -u mjc@apache.org --raw
{
    "UUID": "XX",
    "active": true,
    "authority": {
        "active_roles": []
    },
    "org_UUID": "XX",
    "time": {
        "created": "2021-06-15T12:48:44.312Z",
        "modified": "2021-06-15T12:48:44.312Z"
    },
    "username": "mjc@apache.org"
}
mprpic commented 1 year ago

Hmm, I thought that was fixed in https://github.com/CVEProject/cve-services/issues/436 and the name object should be returned even if all of its values are empty. I guess https://github.com/CVEProject/cve-services/pull/451/commits/260512963bb20a07d97281518e454813eb39a56e didn't really address this... I'll file an issue with cve-services and will work around it here for now.

mprpic commented 1 year ago

Even though this was fixed in code in cvelib to account for the missing name object, it turned out to be resolved by a data migration in CVE Services itself to fill in empty values for the users that didn't have names before 2.1 was released. So even version 1.0.0 of cvelib should not encounter this error any more. Still, will keep the "fix" in place in cvelib for the time being.

iamamoose commented 1 year ago

agree, for example they changed my entry and I no longer hit this bug with earlier cvelib versions.