Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 5 cipher.key "key must be 32 bytes" error

Brand new Rails application.

Rails version 5.0.0.1, Ruby version 2.4.0preview2.

Create application "demo", run a simple scaffold generate Product, and get an error when trying to view the scaffold's overview page (base index file still loads the Welcome to Rails screen fine):

ArgumentError in ProductsController#index key must be 32 bytes:

  cipher = new_cipher
  cipher.encrypt
  cipher.key = @secret

  # Rely on OpenSSL for the initialization vector
  iv = cipher.random_iv

The problem line is apparently cipher.key = @secret.

I've seen various mentions on the github repo for Rails mentioning this issue, but all implied it was now resolved in Rails 5.0.0.1

like image 762
TheMinimalCriminal Avatar asked Sep 28 '16 07:09

TheMinimalCriminal


Video Answer


1 Answers

Ok, there was a slight misunderstanding on my part, looks like the fix is coming in 5.0.1 not 5.0.0.1

https://github.com/rails/rails/issues/26694

like image 138
TheMinimalCriminal Avatar answered Sep 18 '22 09:09

TheMinimalCriminal