findy-network / findy-wrapper-go

Go wrapper for indy-sdk
Apache License 2.0
6 stars 1 forks source link

RevRegId is defined as int but should be string #63

Closed pstuermlinger closed 5 months ago

pstuermlinger commented 1 year ago

When I confirm a present-proof request, which requests attributes that are part of a revocable credential, I get the following error in findy:

findy-core  | E0120 15:47:00.127938       8 dto.go:28] json: cannot unmarshal string into Go struct field CredentialInfo.cred_info.rev_reg_id of type int: from JSON:
findy-core  | [{"cred_info":{"referent":"dd6ddbb9-035d-409c-9093-3a937ed202e8","attrs":{"lastName":"t","title":"","firstName":"t"},"schema_id":"FnhYpbRquQe6TaECgdYxY5:2:guest:1.0","cred_def_id":"FnhYpbRquQe6TaECgdYxY5:3:CL:17:guest-local-abc001","rev_reg_id":"FnhYpbRquQe6TaECgdYxY5:4:FnhYpbRquQe6TaECgdYxY5:3:CL:17:guest-local-abc001:CL_ACCUM:7efa9955-20ec-477c-a8e8-8b81f0f4c437","cred_rev_id":"1"},"interval":{"from":0,"to":1674229540}}]
findy-core  | E0120 15:47:00.127979       8 handlers.go:70] continue PSM: proof user action handler: create proof: json: cannot unmarshal string into Go struct field CredentialInfo.cred_info.rev_reg_id of type int

Since it complains about rev_reg_id - which looks to be a correct String - I search the findy code and found the following: https://github.com/findy-network/findy-wrapper-go/blob/575dd0bbb46397519207d07d5d797cfeee804f41/anoncreds/anoncreds.go#L180

It says, rev_reg_id is an optional Int. At line 129 of the same file however, it is a String. Same with CredRevId. https://github.com/findy-network/findy-wrapper-go/blob/575dd0bbb46397519207d07d5d797cfeee804f41/anoncreds/anoncreds.go#L129

Due to my lack of Go experience, I can't provide you a PR. Sorry for that.

Regards

github-actions[bot] commented 1 year ago

Issue created by pstuermlinger

lainio commented 1 year ago

Thanks again! I'll check this right away.

lainio commented 1 year ago

Hi, I changed the types in PR #64 and updated findy-agent, and released both which means in our system that they are now in the master branch too.

Unfortunately, we don't have tests because we don't use Indy's revocation system by ourselves.

Please let us know if there's anything else.

Best regards, -Harri

pstuermlinger commented 1 year ago

Wow, you're super fast! I've build the image and will test it on monday. Thank you very much!

Kind regards Patrick

pstuermlinger commented 1 year ago

I've just tested the 0.30.50 version. Unfortunately, I wasn't able to test the fix for this issue. With that version I'm unable to accept an acapy invitation "503 Service unavailable". Downgrading back to the :latest docker image makes it working again.

lainio commented 1 year ago

Hmm.. that's weird. There weren't any references to those fields whose type I changed to from int to string anywhere.

Could you please send the ACAPy invitation to us? I'd try figure out what's going on.

pstuermlinger commented 1 year ago

http://192.168.56.1:10001/?c_i=eyJAdHlwZSI6ICJkaWQ6c292OkJ6Q2JzTlloTXJqSGlxWkRUVUFTSGc7c3BlYy9jb25uZWN0aW9ucy8xLjAvaW52aXRhdGlvbiIsICJAaWQiOiAiY2M0MTRjYjAtMTlkZS00ZTg5LWEwODEtMTFhYTIyNjA0MGE4IiwgImxhYmVsIjogIk15T3JnIiwgInNlcnZpY2VFbmRwb2ludCI6ICJodHRwOi8vMTkyLjE2OC41Ni4xOjEwMDAxIiwgInJlY2lwaWVudEtleXMiOiBbIjZDcmU1QTZlZ3N2dEdtQ0hYNUhheDNaQjFjZUtWbnZicERUM1F5Tjd4NFNwIl19

{"@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation", "@id": "cc414cb0-19de-4e89-a081-11aa226040a8", "label": "MyOrg", "serviceEndpoint": "http://192.168.56.1:10001", "recipientKeys": ["6Cre5A6egsvtGmCHX5Hax3ZB1ceKVnvbpDT3QyN7x4Sp"]}
pstuermlinger commented 1 year ago

@lainio Maybe, because I had to comment out the installation of curl in the Dockerfile? I cannot build the image if uncommented (probably again security reasons).

Dockerfile

...
FROM docker-dev.art.intern/findy-network/findy-base:indy-1.16.ubuntu-18.04

LABEL org.opencontainers.image.source https://github.com/findy-network/findy-agent

# healthcheck utility
# RUN apt-get update && apt-get install -y curl

...

Edit: Working on a Ubuntu host.

lainio commented 1 year ago

I did a fast search, and curl inside the container is used for e2e testing but also solving some docker networking issues which are macOS specific -- AFAIK. Anyhow, the error message seems to be related to networking, though.

I will consult my colleague tomorrow, and we will get back to you.

lauravuo commented 1 year ago

Hi @pstuermlinger, thanks for your feedback!

Just to make sure, let me confirm what is happening here: you were building the findy agency core image yourself, and the building failed (due to the curl installation), which caused the earlier mentioned "503 Service unavailable"? I guess you have been able to build the image before successfully, but now your security restrictions have tightened up?

The curl is installed to the image for our AWS ECS deployment - it does a health check using it: https://github.com/findy-network/findy-agent-infra/blob/8ab04cc49b6684c6b680ae63002c3f646c041a7b/aws-ecs/lib/backend.ts#L239 I agree it is kind of a hack, and should be removed eventually.

pstuermlinger commented 1 year ago

Hi @lauravuo , you're close :) I've always used the prebuild Image ghcr.io/findy-network/findy-agent:latest and I never had to build the image myself.

I've built it just for the fix of this issue, and got an error because of apt-get update && apt-get install -y curl. I commented it out because the code said it's just for healtchecks. I don't know if it relates to the 503 error.

All I can say is: if I use the custom build based on the Master branch, the 503 error occurs. If I only revert the tag of the docker image back to :latest in docker-comose.yaml while leaving all the configs untouched, it works again.

My current workaround is, that I removed the revocabaility of the credential. Will test it again when a new official image is available.

lauravuo commented 1 year ago

Ok, thanks, that clarifies! I would imagine there is something funny in your image building then.

The latest tag points always to the latest codes in the master branch, currently it is the version 0.30.51: https://github.com/findy-network/findy-agent/pkgs/container/findy-agent So I think the latest should include now Harri's fix.