Skip to content

Add encrypted fields for plaintext tokens

What does this MR do and why?

Describe in detail what your merge request does and why.

Database

Migration
== 20211124132319 AddEncryptedStaticObjectsExternalStorageAuthToken: migrating
-- add_column(:application_settings, :static_objects_external_storage_auth_token_encrypted, :text)
   -> 0.0028s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE application_settings\nADD CONSTRAINT check_32710817e9\nCHECK ( char_length(static_objects_external_storage_auth_token_encrypted) <= 255 )\nNOT VALID;\n")
   -> 0.0049s
-- current_schema()
   -> 0.0002s
-- execute("SET statement_timeout TO 0")
   -> 0.0006s
-- execute("ALTER TABLE application_settings VALIDATE CONSTRAINT check_32710817e9;")
   -> 0.0020s
-- execute("RESET statement_timeout")
   -> 0.0007s
== 20211124132319 AddEncryptedStaticObjectsExternalStorageAuthToken: migrated (0.0317s)

== 20211124132522 AddEncryptedStaticObjectToken: migrating ====================
-- add_column(:users, :static_object_token_encrypted, :text)
   -> 0.0018s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0003s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE users\nADD CONSTRAINT check_7bde697e8e\nCHECK ( char_length(static_object_token_encrypted) <= 255 )\nNOT VALID;\n")
   -> 0.0017s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE users VALIDATE CONSTRAINT check_7bde697e8e;")
   -> 0.0015s
== 20211124132522 AddEncryptedStaticObjectToken: migrated (0.0128s) ===========
Rollback
== 20211124132522 AddEncryptedStaticObjectToken: reverting ====================
-- transaction_open?()
   -> 0.0000s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE users\nDROP CONSTRAINT IF EXISTS check_7bde697e8e\n")
   -> 0.0014s
-- remove_column(:users, :static_object_token_encrypted)
   -> 0.0012s
== 20211124132522 AddEncryptedStaticObjectToken: reverted (0.0120s) ===========

== 20211124132319 AddEncryptedStaticObjectsExternalStorageAuthToken: reverting
-- transaction_open?()
   -> 0.0000s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE application_settings\nDROP CONSTRAINT IF EXISTS check_32710817e9\n")
   -> 0.0017s
-- remove_column(:application_settings, :static_objects_external_storage_auth_token_encrypted)
   -> 0.0014s
== 20211124132319 AddEncryptedStaticObjectsExternalStorageAuthToken: reverted (0.0130s)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports