Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing a Credential with a negative numeric string value causes Marshmallow.exceptions.ValidationError #1462

Closed
Jsyro opened this issue Oct 28, 2021 · 2 comments

Comments

@Jsyro
Copy link
Contributor

Jsyro commented Oct 28, 2021

As the holder, after a credential offer is accepted, as aca-py is storing the credential, encoded values go through a marshmallow validator and a marshmallow.exceptions.validationError gets thrown.

bpa-agent2_1      | Traceback (most recent call last):
bpa-agent2_1      |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aries_cloudagent/messaging/models/base.py", line 137, in deserialize
bpa-agent2_1      |     return schema.loads(obj) if isinstance(obj, str) else schema.load(obj)
bpa-agent2_1      |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/marshmallow/schema.py", line 723, in load
bpa-agent2_1      |     data, many=many, partial=partial, unknown=unknown, postprocess=True
bpa-agent2_1      |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/marshmallow/schema.py", line 904, in _do_load
bpa-agent2_1      |     raise exc
bpa-agent2_1      | marshmallow.exceptions.ValidationError: {'values': defaultdict(<class 'dict'>, {'Longitude': {'value': {'encoded': ['Value -99 is not a non-negative numeric string']}}})}

A positive number string like '44' will not cause this issue, and including any letter character like '-125 E' will also not occur as it cannot be casted to a numeric python value (int/float).

Here is the raw event that aca-py logged

bpa-agent2_1      | 2021-10-13 22:07:14,153 aries_cloudagent.messaging.base_handler INFO Received credential message: {"@type":"did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/issue-credential","@id":"79a4fde5-eb67-40f6-8cdc-6d23811968e1","~thread":{"thid":"24f5450a-2a0b-40e2-bede-a3514638af60"},"credentials~attach":[{"@id":"libindy-cred-0","mime-type":"application/json","data":{"base64":"eyJzY2hlbWFfaWQiOiAiOU4xWjJyd21R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2NjU4NDU5OTIwNzIwNjYxNzA5ODA0NDcyNjI1OTIwMTg0MDkyODk5MjI4MzA1Mzg4OTk1Mzk4MTk1MTAyNjI5OTgwMTU3OTQ4NDQxMjE0OTAzNDMyMzEzMzQwNjIwNzQxMTgxODI1MTgxMzcxMjYyNzY1MTU3MjM0OTg0MTg4NDI2ODg5MjkxMzQ5MDIwNzMwOTExNzE5MzM0MzgzMjE2NjU4NzIzNTg4OTcwMzQ0MDM4NDg3NDQ0NTk0Njc0OTE5NjYyMjY1MDEzMTk5MDE0MjkxNzM2NjgyMDM4NjQ2MzAzOTQ4ODcxNDM2NTUyNjAxNjgyMzE1ODEzMjc4NDA3MTc3MDg2NTk4OTgwNTc0MTc1MDYyNTA0MTI5NTMxNTkyNTcxMzMzMDQ2MDA0MjIzNTcxMTYzMzg2OTYwODI1NjAwOTE2NDcxNTU2MDg4ODIzMjI3MzgwNzQ4MjY2MDU3OTEzODk4MDk1OTQwODYwOTA1OTMyNTQwODAwODQ3ODIxOTAxNDczNDYxNjI1NjM1MzMwODU2MzE0MjA1MTQ5MDk0Mjk1NTUzODM3NjM1MTE1MTczMTg3MjAwNjI1MDM1MjIzNjIwNjE1MCIsICJjIjogIjExMTE3ODcyMDM5ODU2OTEzMzMyNzIxNTc2NjQ1ODI5MTcyODg2ODgzMDM4MzQxMzg2NTc3Mzc5MDIzOTcyMDQ4OTE1MTM1MDYwOTY5OSJ9LCAicmV2X3JlZyI6IG51bGwsICJ3aXRuZXNzIjogbnVsbH0="}}]}
@ianco
Copy link
Contributor

ianco commented Nov 3, 2021

See PR #1475

Tested out negative encodings and doesn't seem to cause any issues

@swcurran
Copy link
Contributor

swcurran commented Jun 3, 2022

Based on @ianco 's comment -- closing this. Please reopen if something more is needed.

@swcurran swcurran closed this as completed Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants