class Bundler::Audit::Scanner

def initialize(root=Dir.pwd)

Parameters:
  • root (String) --
def initialize(root=Dir.pwd)
  @root     = File.expand_path(root)
  @database = Database.new
  @lockfile = LockfileParser.new(
    File.read(File.join(@root,'Gemfile.lock'))
  )
end

def scan(options={})

Returns:
  • (Enumerator) -

Other tags:
    Yieldparam: result -

Other tags:
    Yield: -

Options Hash: (**options)
  • :ignore (Array) --

Parameters:
  • options (Hash) --
def scan(options={})
  return enum_for(__method__,options) unless block_given?
  ignore = Set[]
  ignore += options[:ignore] if options[:ignore]
  @lockfile.sources.map do |source|
    case source
    when Source::Git
      case source.uri
      when /^git:/, /^http:/
        yield InsecureSource.new(source.uri)
      end
    when Source::Rubygems
      source.remotes.each do |uri|
        if uri.scheme == 'http'
          yield InsecureSource.new(uri.to_s)
        end
      end
    end
  end
  @lockfile.specs.each do |gem|
    @database.check_gem(gem) do |advisory|
      unless ignore.include?(advisory.id)
        yield UnpatchedGem.new(gem,advisory)
      end
    end
  end
  return self
end