Class: YAVDB::Sources::RustSec::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/yavdb/sources/rustsec.rb

Constant Summary collapse

REPOSITORY_URL =
'https://github.com/RustSec/advisory-db'.freeze
PACKAGE_MANAGER =
'cargo'.freeze

Class Method Summary collapse

Class Method Details

.advisories ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/yavdb/sources/rustsec.rb', line 31

def self.advisories
  YAVDB::SourceTypes::GitRepo.search('crates/**/*.toml', REPOSITORY_URL).map do |repo_path, file_paths|
    Dir.chdir(repo_path) do
      file_paths.map do |file_path|
        advisory_hash = TomlRB.load_file(file_path)
        create(advisory_hash['advisory'])
      end
    end
  end.flatten
end