Currently we create a dictionary of all the report data (eg. questions, choices, the choice picked, question answers, etc...), encrypt that with the secret key, and store it in report_data as json. The problem with this approach is that it copies question fields and IDs into the json data as strings. And, similarly to every other time an ID or field is denormalized, this approach is extremely vulnerable to error whenever the report questions are changed.
This system needs to be redesigned in such a way that questions are linked to the reports with foreign keys (perhaps with a new Answers model), but any identifying information about the answers (answer text, choice ids, etc) is encrypted at rest with the user's secret key.
Currently we create a dictionary of all the report data (eg. questions, choices, the choice picked, question answers, etc...), encrypt that with the secret key, and store it in
report_data
as json. The problem with this approach is that it copies question fields and IDs into the json data as strings. And, similarly to every other time an ID or field is denormalized, this approach is extremely vulnerable to error whenever the report questions are changed.This system needs to be redesigned in such a way that questions are linked to the reports with foreign keys (perhaps with a new Answers model), but any identifying information about the answers (answer text, choice ids, etc) is encrypted at rest with the user's secret key.