Sha256: 2a48e8c5558aad662597bfcfd5bb9ef3c8c2d87e973030934e9607ecde60fe2b

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe "The security check for Ruby interpreter version" do
  before(:all) do
    @check = Dawn::Kb::RubyVersionCheck.new(:name=>"Mocked",
                                            :kind=>Dawn::KnowledgeBase::RUBY_VERSION_CHECK,
                                            :applies=>['sinatra', 'padrino', 'rails'])
    @check.safe_rubies=[{:version=>"1.9.3", :patchlevel=>"p392"}, {:version=>"2.0.0", :patchlevel=>"p0"}]
  end

  it "fires if ruby version is vulnerable" do
    @check.detected_ruby = {:version=>"1.9.2", :patchlevel=>"p10000"}
    expect(@check.vuln?).to    eq(true)
  end
  it "doesn't fire if ruby version is not vulnerable and patchlevel is not vulnerable" do
    @check.detected_ruby = {:version=>"1.9.4", :patchlevel=>"p10000"}
    expect(@check.vuln?).to    eq(false)
  end

  it "doesn't fire if ruby version is vulnerable and patchlevel is not vulnerable" do
    @check.detected_ruby = {:version=>"1.9.3", :patchlevel=>"p10000"}
    expect(@check.vuln?).to    eq(false)
  end

  it "fires if ruby version is vulnerable and patchlevel is vulnerable" do
    @check.detected_ruby = {:version=>"1.9.3", :patchlevel=>"p391"}
    expect(@check.vuln?).to    eq(true)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dawnscanner-2.2.0 spec/lib/kb/codesake_ruby_version_check_spec.rb