An unofficial, mostly Bitwarden-compatible API server written in Ruby (Sinatra and ActiveRecord)

Fix 3c5a7ca65

Set null kdf_iterations to 5000, which is what the old default used
to be. As the default changes in the future (or as it did in
5ccd4174b), this should still be 5000.

+6 -4
+6 -4
db/migrate/20190724163354_no_null_kdf_iterations.rb
··· 1 1 class NoNullKdfIterations < ActiveRecord::Migration[5.1] 2 2 def change 3 3 User.all.each do |u| 4 + # any old users without a kdf_iterations value probably have the old 5 + # value of 5000 4 6 if !u.kdf_iterations 5 - u.kdf_iterations = Bitwarden::KDF::DEFAULT_ITERATIONS[User::DEFAULT_KDF_TYPE] 6 - end 7 - if !u.kdf_type 8 - u.kdf_type = User::DEFAULT_KDF_TYPE 7 + u.kdf_iterations = 5000 8 + u.kdf_type = Bitwarden::KDF::PBKDF2 9 9 end 10 10 u.save! 11 11 end 12 12 13 + # but going forward, any new users should get whatever defaults are set in 14 + # the future 13 15 change_column :users, :kdf_iterations, :integer, :null => false, 14 16 :default => Bitwarden::KDF::DEFAULT_ITERATIONS[User::DEFAULT_KDF_TYPE] 15 17 end