Skip to content

Add Cop::AttrEncrypted

Max Orefice requested to merge morefice/attr-encrypted-cop into master

Ref: #26243

What does this MR do and why?

This MR introduces a new cop to discontinue the usage of attr_encrypted gem now that we upgraded to rails 7 which supports column encryption out of the box.

Next step is to set up ActiveRecord encryption keys and and update our documentation.

Example

➜  gitlab git:(master) ✗ bundle exec rubocop app/models/ci/pipeline.rb
Inspecting 1 file
C

Offenses:

app/models/ci/pipeline.rb:163:5: C: Cop/AttrEncrypted: Do not use attr_encrypted to encrypt a column as this gem is now deprecated since we are running Rails 7. See https://gitlab.com/gitlab-org/gitlab/-/issues/26243 for more details
    attr_encrypted :value, ...
    ^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

MR acceptance checklist

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

Merge request reports