xlab-si / emmy

Library for zero-knowledge proof based applications (like anonymous credentials)
Apache License 2.0
233 stars 54 forks source link

Server crashes if invalid organization name is passed #36

Open zitnik opened 7 years ago

zitnik commented 7 years ago

If organization name passed in TransferCredential RPC is not a name of saved organization ("org1"), dlogMap["p"] returns nil, which causes panic: interface conversion: interface {} is nil, not string here: https://github.com/xlab-si/emmy/blob/ee2f257ecefbcb121b9f2786a5ff9c911e9fa97d/config/config.go#L114

I assume the same would happen on other functions loading configuration parameters.

I suggest checking if the organization exists, returning nil, and handling that in higher functions as well, so that the server returns a request error.

The issue can be reproduced with the demo Android app pushed here: https://github.com/zitnik/emmy-demo-android/tree/invalid-org-test

mancabizjak commented 6 years ago

I have some work under way that will check for these sorts of errors when invalid configuration is passed; this concerns the way in which configuration will be handled in general, not only for this particular case.

In addition, as discussed offline, it probably doesn't make sense for the same verifier to support multiple organizations, as each verifier runs on behalf of a single organization, so all references to organization names will also be removed.