Sha256: ecce4142ba8edc213a2e21793f421f4abe480a018f59960daeafe48d32ec4685

Contents?: true

Size: 1.03 KB

Versions: 40

Compression:

Stored size: 1.03 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,
      :cwe_id => [79]
  end
end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
brakeman-7.0.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-7.0.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-7.0.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-6.2.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-6.2.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-6.2.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-6.2.2.rc1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-6.2.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-6.2.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-6.2.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-6.2.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-6.2.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-6.2.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-6.1.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-6.1.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-6.1.2 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-min-6.1.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-lib-6.1.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-6.1.1 lib/brakeman/checks/check_safe_buffer_manipulation.rb
brakeman-6.1.0 lib/brakeman/checks/check_safe_buffer_manipulation.rb