Commit 93977bc
authored
Encrypt teacher invitation email address (#368)
## Status
Related to:
https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/159
## What's changed?
This PR ensures that the `email_address` field on the
`teacher_invitations` table is encrypted. We can't currently avoid
storing this PII in the editor-api database (as we need to use the email
adress to send the invitation email) but this change helps mitigate the
risk of someone getting access to the production database.
We haven't sent any teacher invitation emails in production yet, so we
don't need to worry about migrating or encrypting any existing data.
## Steps to perform before deploying to production
We need to set the following ENV variables on non-local environments:
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT
Rails provides a command, `bin/rails db:encryption:init` to generate
suitable values for these, but any long non-guessable strings should be
fine.File tree
5 files changed
+23
-0
lines changed- .circleci
- app/models
- config/initializers
- spec/models
5 files changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
67 | 74 | | |
0 commit comments