Sha256: a91cf098e3c1b40bbee6c6d7bc8d22ca1c53ff49abd2272f4537286d0c6ae2b7

Contents?: true

Size: 1.01 KB

Versions: 105

Compression:

Stored size: 1.01 KB

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 = msg(msg_version(rails_version), " has a vulnerability in ", msg_code("SafeBuffer"), ". Upgrade to ", msg_version(suggested_version), " or apply patches")

    warn :warning_type => "Cross-Site Scripting",
      :warning_code => :safe_buffer_vuln, 
      :message => message,
      :confidence => :medium,
      :gem_info => gemfile_or_environment
  end
end

Version data entries

105 entries across 91 versions & 4 rubygems

Version Path
brakeman-5.2.3 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-5.2.3 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-5.2.3 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-5.2.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-5.2.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-5.2.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-5.2.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-5.2.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-5.2.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-5.2.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-5.2.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-5.2.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-5.1.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-5.1.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-5.1.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-5.1.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-5.1.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-5.1.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-5.1.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-5.1.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb