Closed vectorhacker closed 8 months ago
Hi,
If you change from encrypted to unencrypted or vice-versa, you should perform a database migration to change those fields.
Alternatively, read without a schema and update the time.
Your PR suggests handling JSON encodings, but there could be any other formats that your PR won't address.
So I'd rather not apply the PR to handle just one such case out of a potential large set of encodings.
Describe the bug
When adding encryption to fields that were previously unencrypted the algorithm will fail in the case of finding a stringified JSON object because of the ':' character.
To Reproduce
First create a schema with a previously unencrypted field which stores a stringified JSON object. Store some unencrypted JSON strings. Later enable encryption for that field and try to decrypt the records with unencrypted JSON. Usually text should just pass through silently, but this time it will find the ':' characters in the JSON string and throw an error when trying to decrypt.