Sha256: dafab5271b260d834e63cfaff7679424da5b2b584befa145b8ba9fd7e1c4e434

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

# Rails 2.3.4 screwed up cookie sessions under 1.9
# ref: https://rails.lighthouseapp.com/projects/8994/tickets/3144

module ActiveSupport

  class MessageVerifier

    private

      undef_method :secure_compare
      warn "overriding secure_compare to be Ruby 1.9-friendly"

      # constant-time comparison algorithm to prevent timing attacks
      def secure_compare(a, b)
        if a.bytesize == b.bytesize
          result = 0
          j = b.each_byte
          a.each_byte { |i| result |= i ^ j.next }
          result == 0
        else
          false
        end
      end

  end
end if Rails::VERSION::STRING == "2.3.4" && "."[0] == "."

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
upr-0.3.0 examples/rails_app-2.3.4/config/initializers/ruby_19_compat.rb
upr-0.2.0 examples/rails_app-2.3.4/config/initializers/ruby_19_compat.rb