Skip to content
Snippets Groups Projects

Upgrade devise, devise-two-factor, and attr_encrypted

Devise (3.5.4 => 4.1.1) Changelog: https://github.com/plataformatec/devise/blob/master/CHANGELOG.md

devise-two-factor (2.0.1 => 3.0.0) Changelog: https://github.com/tinfoil/devise-two-factor/blob/master/CHANGELOG.md

attr_encrypted (1.3.4 => 3.0.1) Changelog: https://github.com/attr-encrypted/attr_encrypted/blob/master/CHANGELOG.md

Devise 4 includes support for Rails 5, working towards #14286 (moved). devise-async doesn't support Devise 4.0 and in 4.1 the bug that was blocking using Devise's built-in ActiveJob integration was fixed. So devise-async is removed. devise-two-factor 3.0.0 is required for Devise 4 support.

attr_encrypted and encryptor are optional but recommended upgrades for devise-two-factor 3.0.0. The mode and algorithm will need to be changed in order to update to attr_encrypted 4.x in the future.

cc: @rspeicher

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
11 11 format: { with: /\A[a-zA-Z0-9_]+\z/,
12 12 message: "can contain only letters, digits and '_'." }
13 13
14 attr_encrypted :value, mode: :per_attribute_iv_and_salt, key: Gitlab::Application.secrets.db_key_base
14 attr_encrypted :value,
15 mode: :per_attribute_iv_and_salt,
16 key: Gitlab::Application.secrets.db_key_base,
17 algorithm: 'aes-256-cbc'
  • 23 23 end
    24 24
    25 25 it 'fails to decrypt if iv is incorrect' do
    26 subject.encrypted_value_iv = nil
    26 subject.encrypted_value_iv = SecureRandom.hex
  • 11 11 format: { with: /\A[a-zA-Z0-9_]+\z/,
    12 12 message: "can contain only letters, digits and '_'." }
    13 13
    14 attr_encrypted :value, mode: :per_attribute_iv_and_salt, key: Gitlab::Application.secrets.db_key_base
    14 attr_encrypted :value,
    15 mode: :per_attribute_iv_and_salt,
    • I'm a little concerned about this note in the changelog for 2.0.0:

      Deprecated: :single_iv_and_salt and :per_attribute_iv_and_salt modes are deprecated and will be removed in the next major release.

      At 3.0, we're now on the "next major release" but there's no further mention of this.

    • 3.0 was released to fix the security vulnerability in 2.0, so my understanding is that that was delayed to 4.0.

  • 12 12 post(:create, user: { login: 'invalid', password: 'invalid' })
    13 13
    14 14 expect(response)
    15 .to set_flash.now[:alert].to /Invalid login or password/
    15 .to set_flash.now[:alert].to /Invalid Login or password/
  • @rspeicher I don't think the grammar issue warrants blocking this MR, do my comments address all your concerns?

  • Ok, I tried this locally with an account that already had 2FA enabled and both the OTP and the backup codes worked without issue, so I think we're good.

    Thanks @connorshea :thumbsup:

  • Robert Speicher Status changed to merged

    Status changed to merged

  • Robert Speicher mentioned in commit 7d33fba7

    mentioned in commit 7d33fba7

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading