trustbloc / edv

Encrypted data vault implementation in Golang - https://identity.foundation/edv-spec/
Apache License 2.0
16 stars 17 forks source link

Storage failures if database prefix is not set or contains incompatible characters when using CouchDB #190

Open DRK3 opened 3 years ago

DRK3 commented 3 years ago

When using CouchDB, when the EDV server creates a vault, the EDV server generates a UUID to use internally as the CouchDB databases name. Sometimes these UUIDs will start with a number, which is an invalid database name for CouchDB. If you're using a valid prefix, this isn't a problem, but if no prefix is set then some vaults will randomly fail to create, which is super confusing.

Also, if you set a prefix that contains those non-CouchDB-characters, then database creation will fail as well. However, this case isn't as severe since the failure will at least happen at startup and be far more obvious.

DRK3 commented 2 years ago

This is mostly addressed by #250. The UUID thing is no longer applicable, the only thing that remains is the prefix issue, which is minor. An error will happen at startup from CouchDB, but the error message is a little bit low-level sounding. While there's a good chance the user may figure out the issue from that message (as CouchDB's message describes the database limitations), it would be a bit nicer if we detect the issue and give the user a more direct error message explaining that the issue is with their EDV prefix setting.