openwallet-foundation / acapy

ACA-Py is a foundation for building decentralized identity applications and services running in non-mobile environments.
https://aca-py.org
Apache License 2.0
419 stars 512 forks source link

[BUG] Handle get key operation when no tag has been set #3256

Closed PatStLouis closed 1 month ago

PatStLouis commented 1 month ago

Handle cases where a key doesn't have a tags property.

@dbluhm @jamshale small but critical bug introduced by my last PR, I was under the impression every key had tags by default but it doesn't seem like so, this will handle such cases.

PatStLouis commented 1 month ago

another fix could be to change this line: https://github.com/OpSecId/aries-cloudagent-python/blob/036f108a5ea4fbc4805b49be6bdc8fd02b1511f6/aries_cloudagent/wallet/askar.py#L100

from:

if kid:
    tags = {"kid": kid}
else:
    tags = None

to

if kid:
    tags = {"kid": kid}
else:
    tags = {}

I believe this would be more consistent as a fix since all keys will have a tags object. Any opinion?

PatStLouis commented 1 month ago

I made a combination of @jamshale suggestion and the latter idea.

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud