feat(encryption): Use EncryptedCharField in TempestCredentials #103515
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an SQL no-op, but the change IS NOT no-op - we will start writing entries in
client_secretcolumn in a new format (enc:plaintext:<base64_value>), but still without any problems read old plain text format!The field and all of the operations on it has already been tested in a sandbox.
Instead of using the basic Django's
CharField, we are now moving toEncryptedCharField(inheritsCharField) which encrypts/decrypts the value on the fly. This changes nothing in how we use the value in the codebase, since in memory once the object is fetched, the value is decrypted, but while saving it to db, we will no longer save it in plain text.This is the first of many models that will be migrated to a new encrypted field.
More info about the project can be found here.
The encryption method is controlled via
database.encryption.methodoption, so for now we will still write everything in plain text, and slowly - region by region switch this to Fernet encryption.EncryptedCharField is implemented here:
sentry/src/sentry/db/models/fields/encryption.py
Line 273 in 5a6903b
Closes TET-1459: Migrate TempestCredential model