summaryrefslogtreecommitdiff
path: root/lib/gitlab/background_migration/models/encrypt_columns/web_hook.rb
blob: 34e72fd9f34361e40cde9e84293e1b9065abf896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    module Models
      module EncryptColumns
        # This model is shared between synchronous and background migrations to
        # encrypt the `token` and `url` columns
        class WebHook < ActiveRecord::Base
          include ::EachBatch

          self.table_name = 'web_hooks'
          self.inheritance_column = :_type_disabled

          attr_encrypted :token,
                         mode:      :per_attribute_iv,
                         algorithm: 'aes-256-gcm',
                         key:       ::Settings.attr_encrypted_db_key_base_32

          attr_encrypted :url,
                         mode:      :per_attribute_iv,
                         algorithm: 'aes-256-gcm',
                         key:       ::Settings.attr_encrypted_db_key_base_32
        end
      end
    end
  end
end