Skip to content

Introduce a new .migrate_to_encrypts method

What does this MR do and why?

Extracted from Migrate `application_settings.asset_proxy_secre... (!189940 - merged) • Rémy Coutable • 18.1.

This change introduces a migration path from an older encryption framework (attr_encrypted) to a newer one (encrypts) in GitLab. The new migrate_to_encrypts method allows for a smooth transition by temporarily storing data in both encryption formats, ensuring backward compatibility while migrating. When an attribute is set, it's saved using both encryption methods, and when retrieved, the system first checks the new format before falling back to the old one. The code also includes test examples to verify that attributes being migrated are properly encrypted with both frameworks. This approach enables gradual migration without disrupting existing encrypted data.

References

How to set up and validate locally

For now, we don't need to test it locally, but it's actually used in Migrate `application_settings.asset_proxy_secre... (!189940 - merged) • Rémy Coutable • 18.1.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rémy Coutable

Merge request reports

Loading