Sha256: 83f06e85d7c79fc8cd023680d6fb007bbf829a70fa84654adcb1fdd52dcefe6a

Contents?: true

Size: 1015 Bytes

Versions: 12

Compression:

Stored size: 1015 Bytes

Contents

require 'brakeman/checks/base_check'

#Check for unsafe manipulation of strings
#Right now this is just a version check for
#https://groups.google.com/group/rubyonrails-security/browse_thread/thread/edd28f1e3d04e913?pli=1
class Brakeman::CheckSafeBufferManipulation < Brakeman::BaseCheck
  Brakeman::Checks.add self

  @description = "Check for Rails versions with SafeBuffer bug"

  def run_check

    if version_between? "3.0.0", "3.0.11"
      suggested_version = "3.0.12"
    elsif version_between? "3.1.0", "3.1.3"
      suggested_version = "3.1.4"
    elsif version_between? "3.2.0", "3.2.1"
      suggested_version = "3.2.2"
    else
      return
    end

    message = "Rails #{tracker.config[:rails_version]} has a vulnerabilty in SafeBuffer. Upgrade to #{suggested_version} or apply patches."

    warn :warning_type => "Cross Site Scripting",
      :warning_code => :safe_buffer_vuln, 
      :message => message,
      :confidence => CONFIDENCE[:med],
      :gem_info => gemfile_or_environment
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
brakeman-3.0.5 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-3.0.5 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-3.0.4 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-3.0.4 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-3.0.3 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-3.0.3 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-3.0.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-3.0.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-3.0.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-3.0.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-3.0.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-3.0.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb