Skip to content

Ruby 2.2.0 + bcrypt + ActiveRecord + YAML → BCrypt::Errors::InvalidSalt #106

Closed

Description

@be9

There's a problem with dumping AR records using bcrypt under Ruby 2.2.0. I isolated the problem here: https://gist.github.com/be9/c549ff6469d5627aa900

The script shows how to run the thing and what happens. Everything works perfectly under Ruby 2.1.5, but under Ruby 2.2.0 exception gets raised.

Activity

  1. recurser commented on Jan 8, 2015

    @recurser

    👍

  2. be9 commented on Jan 8, 2015

    @be9
    Author

    Updated the gist with even more minimal test: https://gist.github.com/be9/c549ff6469d5627aa900#file-minitest-rb

    require 'rubygems'
    require 'bundler/setup'
    require 'bcrypt'
    require 'psych'
    
    # This raises BCrypt::Errors::InvalidSalt under Ruby 2.2.0 and bcrypt 3.1.9
    BCrypt::Password.create("my password").to_yaml
  3. added a commit that references this issue on Jan 9, 2015
    f1621d6
  4. ugoa commented on Jan 13, 2015

    @ugoa

    👍

  5. svoop commented on Jan 23, 2015

    @svoop

    Thanks for the fix, @mattwildig, hope it will be adopted and published soon. (With omniauth-identity, this issue causes quite some headache, at least I couldn't bundle the fixed version from mattwildig/bcrypt-ruby and had to manually patch the line in the deployed gem.)

  6. jmccartie commented on Jan 24, 2015

    @jmccartie

    👍

  7. rmarescu commented on Jan 28, 2015

    @rmarescu

    👍

    A bit of a blocker for anybody who uses bcrypt and wants to upgrade to Ruby 2.2.0

  8. svoop commented on Jan 29, 2015

    @svoop

    Thanks a bunch, @tjschuck !

  9. rmarescu commented on Jan 29, 2015

    @rmarescu

    Awesome, thanks!

  10. yukas commented on Mar 31, 2016

    @yukas

    Hey, guys

    Although bug is already fixed in 3.1.10, problem still persists in Rails 3.2, because it is locked on bcrypt-ruby ~> 3.0.0.

    Can we release bcrypt-ruby 3.0.x with this bug fixed?

    I already made the fix here, but there is no bcrypt-ruby 3.0.x branch to make a PR :(

    Can someone help me with releasing 3.0.x version with this bug fixed?

  11. yukas commented on Apr 1, 2016

    @yukas

    @tjschuck can you help me out here?

  12. tjschuck commented on Apr 7, 2016

    @tjschuck
    Collaborator

    @yukas Rails 3.2 is no longer supported even for security updates, so you should either a.) upgrade to a more recent version of Rails, or b.) already be maintaining your own fork of 3.2 so that you can patch it with fixes like the one you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions