bundler-audit 0.6.1 → 0.9.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -0
- data/.github/ISSUE_TEMPLATE/bug-report.md +44 -0
- data/.github/workflows/ruby.yml +42 -0
- data/.gitignore +1 -1
- data/.rspec +1 -1
- data/.rubocop.yml +83 -0
- data/COPYING.txt +4 -4
- data/ChangeLog.md +111 -4
- data/Gemfile +7 -3
- data/README.md +85 -23
- data/Rakefile +17 -30
- data/bundler-audit.gemspec +3 -11
- data/gemspec.yml +2 -2
- data/lib/bundler/audit/advisory.rb +81 -9
- data/lib/bundler/audit/cli/formats/json.rb +65 -0
- data/lib/bundler/audit/cli/formats/junit.rb +127 -0
- data/lib/bundler/audit/cli/formats/text.rb +122 -0
- data/lib/bundler/audit/cli/formats.rb +148 -0
- data/lib/bundler/audit/cli/thor_ext/shell/basic/say_error.rb +33 -0
- data/lib/bundler/audit/cli.rb +114 -88
- data/lib/bundler/audit/configuration.rb +108 -0
- data/lib/bundler/audit/database.rb +161 -29
- data/lib/bundler/audit/report.rb +149 -0
- data/lib/bundler/audit/results/insecure_source.rb +78 -0
- data/lib/bundler/audit/results/result.rb +21 -0
- data/lib/bundler/audit/results/unpatched_gem.rb +98 -0
- data/lib/bundler/audit/results.rb +19 -0
- data/lib/bundler/audit/scanner.rb +105 -26
- data/lib/bundler/audit/task.rb +19 -6
- data/lib/bundler/audit/version.rb +3 -3
- data/lib/bundler/audit.rb +2 -2
- data/spec/advisory_spec.rb +153 -20
- data/spec/bundle/insecure_sources/Gemfile.lock +151 -0
- data/spec/bundle/secure/Gemfile +1 -0
- data/spec/bundle/secure/Gemfile.lock +123 -0
- data/spec/bundle/unpatched_gems/Gemfile +1 -1
- data/spec/bundle/unpatched_gems/Gemfile.lock +31 -0
- data/spec/bundle/unpatched_gems_with_dot_configuration/.bundler-audit.yml +3 -0
- data/spec/bundle/unpatched_gems_with_dot_configuration/Gemfile +3 -0
- data/spec/bundle/unpatched_gems_with_dot_configuration/Gemfile.lock +31 -0
- data/spec/cli/formats/json_spec.rb +114 -0
- data/spec/cli/formats/junit_spec.rb +284 -0
- data/spec/cli/formats/text_spec.rb +273 -0
- data/spec/cli/formats_spec.rb +86 -0
- data/spec/cli_spec.rb +100 -21
- data/spec/configuration_spec.rb +78 -0
- data/spec/database_spec.rb +286 -39
- data/spec/fixtures/advisory/CVE-2020-1234.yml +21 -0
- data/spec/fixtures/{not_a_hash.yml → advisory/not_a_hash.yml} +0 -0
- data/spec/fixtures/config/bad/empty.yml +0 -0
- data/spec/fixtures/config/bad/ignore_contains_a_non_string.yml +4 -0
- data/spec/fixtures/config/bad/ignore_is_not_an_array.yml +3 -0
- data/spec/fixtures/config/valid.yml +4 -0
- data/spec/fixtures/lib/bundler/audit/cli/formats/bad.rb +17 -0
- data/spec/fixtures/lib/bundler/audit/cli/formats/good.rb +17 -0
- data/spec/integration_spec.rb +17 -89
- data/spec/report_spec.rb +98 -0
- data/spec/results/insecure_source_spec.rb +47 -0
- data/spec/results/result_spec.rb +10 -0
- data/spec/results/unpatched_gem_spec.rb +123 -0
- data/spec/scanner_spec.rb +90 -34
- data/spec/spec_helper.rb +40 -35
- metadata +47 -383
- data/.gitmodules +0 -3
- data/.travis.yml +0 -13
- data/data/ruby-advisory-db/.gitignore +0 -1
- data/data/ruby-advisory-db/.rspec +0 -1
- data/data/ruby-advisory-db/.travis.yml +0 -12
- data/data/ruby-advisory-db/CONTRIBUTING.md +0 -69
- data/data/ruby-advisory-db/CONTRIBUTORS.md +0 -40
- data/data/ruby-advisory-db/Gemfile +0 -9
- data/data/ruby-advisory-db/Gemfile.lock +0 -40
- data/data/ruby-advisory-db/LICENSE.txt +0 -5
- data/data/ruby-advisory-db/README.md +0 -99
- data/data/ruby-advisory-db/Rakefile +0 -26
- data/data/ruby-advisory-db/gems/Arabic-Prawn/OSVDB-104365.yml +0 -12
- data/data/ruby-advisory-db/gems/RedCloth/CVE-2012-6684.yml +0 -21
- data/data/ruby-advisory-db/gems/VladTheEnterprising/CVE-2014-4995.yml +0 -13
- data/data/ruby-advisory-db/gems/VladTheEnterprising/CVE-2014-4996.yml +0 -13
- data/data/ruby-advisory-db/gems/actionmailer/OSVDB-98629.yml +0 -17
- data/data/ruby-advisory-db/gems/actionpack/CVE-2014-0130.yml +0 -23
- data/data/ruby-advisory-db/gems/actionpack/CVE-2014-7818.yml +0 -24
- data/data/ruby-advisory-db/gems/actionpack/CVE-2014-7829.yml +0 -26
- data/data/ruby-advisory-db/gems/actionpack/CVE-2015-7576.yml +0 -116
- data/data/ruby-advisory-db/gems/actionpack/CVE-2015-7581.yml +0 -55
- data/data/ruby-advisory-db/gems/actionpack/CVE-2016-0751.yml +0 -71
- data/data/ruby-advisory-db/gems/actionpack/CVE-2016-0752.yml +0 -96
- data/data/ruby-advisory-db/gems/actionpack/CVE-2016-2097.yml +0 -90
- data/data/ruby-advisory-db/gems/actionpack/CVE-2016-2098.yml +0 -89
- data/data/ruby-advisory-db/gems/actionpack/CVE-2016-6316.yml +0 -57
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-100524.yml +0 -20
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-100525.yml +0 -21
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-100526.yml +0 -27
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-100527.yml +0 -24
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-100528.yml +0 -22
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-103439.yml +0 -24
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-103440.yml +0 -22
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-74616.yml +0 -18
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-77199.yml +0 -23
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-79727.yml +0 -26
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-84243.yml +0 -28
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-84513.yml +0 -23
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-84515.yml +0 -26
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-89026.yml +0 -24
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-91452.yml +0 -20
- data/data/ruby-advisory-db/gems/actionpack/OSVDB-91454.yml +0 -23
- data/data/ruby-advisory-db/gems/actionview/CVE-2016-0752.yml +0 -92
- data/data/ruby-advisory-db/gems/actionview/CVE-2016-2097.yml +0 -89
- data/data/ruby-advisory-db/gems/actionview/CVE-2016-6316.yml +0 -56
- data/data/ruby-advisory-db/gems/activemodel/CVE-2016-0753.yml +0 -92
- data/data/ruby-advisory-db/gems/activerecord/CVE-2014-3514.yml +0 -23
- data/data/ruby-advisory-db/gems/activerecord/CVE-2015-7577.yml +0 -107
- data/data/ruby-advisory-db/gems/activerecord/CVE-2016-6317.yml +0 -73
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-103438.yml +0 -23
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-108664.yml +0 -23
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-108665.yml +0 -24
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-82403.yml +0 -25
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-82610.yml +0 -24
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-88661.yml +0 -20
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-89025.yml +0 -24
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-90072.yml +0 -21
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-90073.yml +0 -23
- data/data/ruby-advisory-db/gems/activerecord/OSVDB-91453.yml +0 -26
- data/data/ruby-advisory-db/gems/activerecord-jdbc-adapter/OSVDB-114854.yml +0 -20
- data/data/ruby-advisory-db/gems/activerecord-oracle_enhanced-adapter/OSVDB-95376.yml +0 -15
- data/data/ruby-advisory-db/gems/activeresource/OSVDB-95749.yml +0 -15
- data/data/ruby-advisory-db/gems/activesupport/CVE-2015-3226.yml +0 -54
- data/data/ruby-advisory-db/gems/activesupport/CVE-2015-3227.yml +0 -32
- data/data/ruby-advisory-db/gems/activesupport/OSVDB-79726.yml +0 -26
- data/data/ruby-advisory-db/gems/activesupport/OSVDB-84516.yml +0 -23
- data/data/ruby-advisory-db/gems/activesupport/OSVDB-89594.yml +0 -25
- data/data/ruby-advisory-db/gems/activesupport/OSVDB-91451.yml +0 -28
- data/data/ruby-advisory-db/gems/administrate/CVE-2016-3098.yml +0 -14
- data/data/ruby-advisory-db/gems/aescrypt/CVE-2013-7463.yml +0 -10
- data/data/ruby-advisory-db/gems/archive-tar-minitar/CVE-2016-10173.yml +0 -16
- data/data/ruby-advisory-db/gems/as/OSVDB-112683.yml +0 -10
- data/data/ruby-advisory-db/gems/authlogic/OSVDB-89064.yml +0 -15
- data/data/ruby-advisory-db/gems/auto_awesomplete/OSVDB-132800.yml +0 -11
- data/data/ruby-advisory-db/gems/auto_select2/OSVDB-132800.yml +0 -13
- data/data/ruby-advisory-db/gems/awesome_spawn/CVE-2014-0156.yml +0 -19
- data/data/ruby-advisory-db/gems/backup-agoddard/OSVDB-108578.yml +0 -8
- data/data/ruby-advisory-db/gems/backup_checksum/OSVDB-108569.yml +0 -12
- data/data/ruby-advisory-db/gems/backup_checksum/OSVDB-108570.yml +0 -10
- data/data/ruby-advisory-db/gems/bcrypt/OSVDB-62067.yml +0 -17
- data/data/ruby-advisory-db/gems/bcrypt-ruby/OSVDB-62067.yml +0 -19
- data/data/ruby-advisory-db/gems/bio-basespace-sdk/OSVDB-101031.yml +0 -8
- data/data/ruby-advisory-db/gems/brbackup/OSVDB-108899.yml +0 -12
- data/data/ruby-advisory-db/gems/brbackup/OSVDB-108900.yml +0 -11
- data/data/ruby-advisory-db/gems/brbackup/OSVDB-108901.yml +0 -11
- data/data/ruby-advisory-db/gems/bson/CVE-2015-4412.yml +0 -16
- data/data/ruby-advisory-db/gems/builder/OSVDB-95668.yml +0 -13
- data/data/ruby-advisory-db/gems/bundler/OSVDB-110004.yml +0 -15
- data/data/ruby-advisory-db/gems/bundler/OSVDB-115090.yml +0 -13
- data/data/ruby-advisory-db/gems/bundler/OSVDB-115091.yml +0 -12
- data/data/ruby-advisory-db/gems/bundler/OSVDB-115917.yml +0 -12
- data/data/ruby-advisory-db/gems/cap-strap/OSVDB-108574.yml +0 -8
- data/data/ruby-advisory-db/gems/cap-strap/OSVDB-108575.yml +0 -7
- data/data/ruby-advisory-db/gems/ciborg/OSVDB-108586.yml +0 -8
- data/data/ruby-advisory-db/gems/cocaine/OSVDB-98835.yml +0 -15
- data/data/ruby-advisory-db/gems/codders-dataset/OSVDB-108582.yml +0 -8
- data/data/ruby-advisory-db/gems/codders-dataset/OSVDB-108583.yml +0 -8
- data/data/ruby-advisory-db/gems/colorscore/CVE-2015-7541.yml +0 -21
- data/data/ruby-advisory-db/gems/command_wrap/OSVDB-91450.yml +0 -9
- data/data/ruby-advisory-db/gems/crack/OSVDB-90742.yml +0 -17
- data/data/ruby-advisory-db/gems/cremefraiche/OSVDB-93395.yml +0 -11
- data/data/ruby-advisory-db/gems/curb/OSVDB-114600.yml +0 -12
- data/data/ruby-advisory-db/gems/curl/OSVDB-91230.yml +0 -13
- data/data/ruby-advisory-db/gems/devise/CVE-2015-8314.yml +0 -14
- data/data/ruby-advisory-db/gems/devise/OSVDB-114435.yml +0 -17
- data/data/ruby-advisory-db/gems/devise/OSVDB-89642.yml +0 -20
- data/data/ruby-advisory-db/gems/devise-two-factor/CVE-2015-7225.yml +0 -22
- data/data/ruby-advisory-db/gems/doorkeeper/CVE-2014-8144.yml +0 -26
- data/data/ruby-advisory-db/gems/doorkeeper/CVE-2016-6582.yml +0 -43
- data/data/ruby-advisory-db/gems/doorkeeper/OSVDB-118830.yml +0 -17
- data/data/ruby-advisory-db/gems/dragonfly/OSVDB-110439.yml +0 -13
- data/data/ruby-advisory-db/gems/dragonfly/OSVDB-90647.yml +0 -16
- data/data/ruby-advisory-db/gems/dragonfly/OSVDB-96798.yml +0 -14
- data/data/ruby-advisory-db/gems/dragonfly/OSVDB-97854.yml +0 -12
- data/data/ruby-advisory-db/gems/echor/OSVDB-102129.yml +0 -12
- data/data/ruby-advisory-db/gems/echor/OSVDB-102130.yml +0 -11
- data/data/ruby-advisory-db/gems/ember-source/CVE-2013-4170.yml +0 -25
- data/data/ruby-advisory-db/gems/ember-source/CVE-2014-0013.yml +0 -33
- data/data/ruby-advisory-db/gems/ember-source/CVE-2014-0014.yml +0 -30
- data/data/ruby-advisory-db/gems/ember-source/CVE-2014-0046.yml +0 -26
- data/data/ruby-advisory-db/gems/ember-source/CVE-2015-1866.yml +0 -26
- data/data/ruby-advisory-db/gems/ember-source/CVE-2015-7565.yml +0 -30
- data/data/ruby-advisory-db/gems/enum_column3/OSVDB-94679.yml +0 -9
- data/data/ruby-advisory-db/gems/espeak-ruby/CVE-2016-10193.yml +0 -15
- data/data/ruby-advisory-db/gems/extlib/OSVDB-90740.yml +0 -18
- data/data/ruby-advisory-db/gems/fastreader/OSVDB-91232.yml +0 -13
- data/data/ruby-advisory-db/gems/fat_free_crm/OSVDB-101445.yml +0 -17
- data/data/ruby-advisory-db/gems/fat_free_crm/OSVDB-101446.yml +0 -19
- data/data/ruby-advisory-db/gems/fat_free_crm/OSVDB-101447.yml +0 -17
- data/data/ruby-advisory-db/gems/fat_free_crm/OSVDB-101448.yml +0 -19
- data/data/ruby-advisory-db/gems/fat_free_crm/OSVDB-101700.yml +0 -16
- data/data/ruby-advisory-db/gems/fat_free_crm/OSVDB-110420.yml +0 -19
- data/data/ruby-advisory-db/gems/fat_free_crm/OSVDB-118465.yml +0 -17
- data/data/ruby-advisory-db/gems/features/OSVDB-96975.yml +0 -8
- data/data/ruby-advisory-db/gems/festivaltts4r/CVE-2016-10194.yml +0 -12
- data/data/ruby-advisory-db/gems/fileutils/OSVDB-90715.yml +0 -7
- data/data/ruby-advisory-db/gems/fileutils/OSVDB-90716.yml +0 -7
- data/data/ruby-advisory-db/gems/fileutils/OSVDB-90717.yml +0 -8
- data/data/ruby-advisory-db/gems/fileutils/OSVDB-90718.yml +0 -7
- data/data/ruby-advisory-db/gems/flash_tool/OSVDB-90829.yml +0 -8
- data/data/ruby-advisory-db/gems/flavour_saver/OSVDB-110796.yml +0 -14
- data/data/ruby-advisory-db/gems/flukso4r/OSVDB-101577.yml +0 -7
- data/data/ruby-advisory-db/gems/fog-dragonfly/OSVDB-110439.yml +0 -15
- data/data/ruby-advisory-db/gems/fog-dragonfly/OSVDB-90647.yml +0 -16
- data/data/ruby-advisory-db/gems/fog-dragonfly/OSVDB-96798.yml +0 -16
- data/data/ruby-advisory-db/gems/fog-dragonfly/OSVDB-97854.yml +0 -12
- data/data/ruby-advisory-db/gems/ftpd/OSVDB-90784.yml +0 -18
- data/data/ruby-advisory-db/gems/git-fastclone/CVE-2015-8968.yml +0 -21
- data/data/ruby-advisory-db/gems/git-fastclone/CVE-2015-8969.yml +0 -13
- data/data/ruby-advisory-db/gems/gitlab-grit/OSVDB-99370.yml +0 -14
- data/data/ruby-advisory-db/gems/gnms/OSVDB-108594.yml +0 -7
- data/data/ruby-advisory-db/gems/gollum/CVE-2015-7314.yml +0 -13
- data/data/ruby-advisory-db/gems/gollum-grit_adapter/CVE-2014-9489.yml +0 -23
- data/data/ruby-advisory-db/gems/gtk2/OSVDB-40774.yml +0 -20
- data/data/ruby-advisory-db/gems/gyazo/OSVDB-108563.yml +0 -10
- data/data/ruby-advisory-db/gems/handlebars-source/OSVDB-131671.yml +0 -17
- data/data/ruby-advisory-db/gems/http/CVE-2015-1828.yml +0 -14
- data/data/ruby-advisory-db/gems/httparty/OSVDB-90741.yml +0 -14
- data/data/ruby-advisory-db/gems/i18n/OSVDB-100528.yml +0 -17
- data/data/ruby-advisory-db/gems/jquery-rails/CVE-2015-1840.yml +0 -36
- data/data/ruby-advisory-db/gems/jquery-ujs/CVE-2015-1840.yml +0 -35
- data/data/ruby-advisory-db/gems/jruby-openssl/CVE-2009-4123.yml +0 -16
- data/data/ruby-advisory-db/gems/jruby-sandbox/OSVDB-106279.yml +0 -12
- data/data/ruby-advisory-db/gems/json/OSVDB-101137.yml +0 -17
- data/data/ruby-advisory-db/gems/json/OSVDB-101157.yml +0 -14
- data/data/ruby-advisory-db/gems/json/OSVDB-90074.yml +0 -23
- data/data/ruby-advisory-db/gems/kafo/OSVDB-106826.yml +0 -15
- data/data/ruby-advisory-db/gems/kajam/OSVDB-108529.yml +0 -12
- data/data/ruby-advisory-db/gems/kajam/OSVDB-108530.yml +0 -11
- data/data/ruby-advisory-db/gems/karo/OSVDB-108573.yml +0 -10
- data/data/ruby-advisory-db/gems/karteek-docsplit/OSVDB-92117.yml +0 -9
- data/data/ruby-advisory-db/gems/kcapifony/OSVDB-108571.yml +0 -8
- data/data/ruby-advisory-db/gems/kcapifony/OSVDB-108572.yml +0 -7
- data/data/ruby-advisory-db/gems/kelredd-pruview/OSVDB-92228.yml +0 -9
- data/data/ruby-advisory-db/gems/kompanee-recipes/OSVDB-108593.yml +0 -12
- data/data/ruby-advisory-db/gems/lawn-login/OSVDB-108576.yml +0 -8
- data/data/ruby-advisory-db/gems/ldap_fluff/OSVDB-90579.yml +0 -15
- data/data/ruby-advisory-db/gems/ldoce/OSVDB-91870.yml +0 -9
- data/data/ruby-advisory-db/gems/lean-ruport/OSVDB-108581.yml +0 -8
- data/data/ruby-advisory-db/gems/lingq/OSVDB-108585.yml +0 -7
- data/data/ruby-advisory-db/gems/loofah/OSVDB-90945.yml +0 -21
- data/data/ruby-advisory-db/gems/lynx/OSVDB-108579.yml +0 -7
- data/data/ruby-advisory-db/gems/lynx/OSVDB-108580.yml +0 -8
- data/data/ruby-advisory-db/gems/mail/OSVDB-131677.yml +0 -26
- data/data/ruby-advisory-db/gems/mail/OSVDB-70667.yml +0 -21
- data/data/ruby-advisory-db/gems/mail/OSVDB-81631.yml +0 -14
- data/data/ruby-advisory-db/gems/mail/OSVDB-81632.yml +0 -16
- data/data/ruby-advisory-db/gems/mapbox-rails/OSVDB-129854.yml +0 -21
- data/data/ruby-advisory-db/gems/mapbox-rails/OSVDB-132871.yml +0 -22
- data/data/ruby-advisory-db/gems/md2pdf/OSVDB-92290.yml +0 -9
- data/data/ruby-advisory-db/gems/mini_magick/OSVDB-91231.yml +0 -15
- data/data/ruby-advisory-db/gems/minitar/CVE-2016-10173.yml +0 -16
- data/data/ruby-advisory-db/gems/moped/CVE-2015-4410.yml +0 -17
- data/data/ruby-advisory-db/gems/multi_xml/OSVDB-89148.yml +0 -16
- data/data/ruby-advisory-db/gems/mustache-js-rails/OSVDB-131671.yml +0 -17
- data/data/ruby-advisory-db/gems/net-ldap/OSVDB-106108.yml +0 -14
- data/data/ruby-advisory-db/gems/newrelic_rpm/OSVDB-90189.yml +0 -17
- data/data/ruby-advisory-db/gems/nokogiri/CVE-2015-1819.yml +0 -52
- data/data/ruby-advisory-db/gems/nokogiri/CVE-2015-5312.yml +0 -92
- data/data/ruby-advisory-db/gems/nokogiri/CVE-2015-7499.yml +0 -37
- data/data/ruby-advisory-db/gems/nokogiri/CVE-2015-8806.yml +0 -42
- data/data/ruby-advisory-db/gems/nokogiri/CVE-2016-4658.yml +0 -32
- data/data/ruby-advisory-db/gems/nokogiri/CVE-2017-5029.yml +0 -44
- data/data/ruby-advisory-db/gems/nokogiri/OSVDB-101179.yml +0 -18
- data/data/ruby-advisory-db/gems/nokogiri/OSVDB-101458.yml +0 -15
- data/data/ruby-advisory-db/gems/nokogiri/OSVDB-118481.yml +0 -15
- data/data/ruby-advisory-db/gems/nokogiri/OSVDB-90946.yml +0 -15
- data/data/ruby-advisory-db/gems/nori/OSVDB-90196.yml +0 -19
- data/data/ruby-advisory-db/gems/omniauth-facebook/OSVDB-99693.yml +0 -22
- data/data/ruby-advisory-db/gems/omniauth-facebook/OSVDB-99888.yml +0 -17
- data/data/ruby-advisory-db/gems/omniauth-oauth2/OSVDB-90264.yml +0 -16
- data/data/ruby-advisory-db/gems/open-uri-cached/OSVDB-121701.yml +0 -13
- data/data/ruby-advisory-db/gems/paperclip/CVE-2015-2963.yml +0 -16
- data/data/ruby-advisory-db/gems/paperclip/OSVDB-103151.yml +0 -13
- data/data/ruby-advisory-db/gems/paratrooper-newrelic/OSVDB-101839.yml +0 -13
- data/data/ruby-advisory-db/gems/paratrooper-pingdom/OSVDB-101847.yml +0 -13
- data/data/ruby-advisory-db/gems/passenger/CVE-2014-1831.yml +0 -13
- data/data/ruby-advisory-db/gems/passenger/CVE-2014-1832.yml +0 -13
- data/data/ruby-advisory-db/gems/passenger/CVE-2015-7519.yml +0 -17
- data/data/ruby-advisory-db/gems/passenger/CVE-2016-10345.yml +0 -16
- data/data/ruby-advisory-db/gems/passenger/OSVDB-90738.yml +0 -16
- data/data/ruby-advisory-db/gems/passenger/OSVDB-93752.yml +0 -15
- data/data/ruby-advisory-db/gems/passenger/OSVDB-94074.yml +0 -14
- data/data/ruby-advisory-db/gems/pdfkit/OSVDB-90867.yml +0 -11
- data/data/ruby-advisory-db/gems/point-cli/OSVDB-108577.yml +0 -8
- data/data/ruby-advisory-db/gems/quick_magick/OSVDB-106954.yml +0 -7
- data/data/ruby-advisory-db/gems/rack/CVE-2015-3225.yml +0 -18
- data/data/ruby-advisory-db/gems/rack/OSVDB-78121.yml +0 -21
- data/data/ruby-advisory-db/gems/rack/OSVDB-89317.yml +0 -21
- data/data/ruby-advisory-db/gems/rack/OSVDB-89320.yml +0 -19
- data/data/ruby-advisory-db/gems/rack/OSVDB-89327.yml +0 -20
- data/data/ruby-advisory-db/gems/rack/OSVDB-89938.yml +0 -18
- data/data/ruby-advisory-db/gems/rack/OSVDB-89939.yml +0 -23
- data/data/ruby-advisory-db/gems/rack-attack/OSVDB-132234.yml +0 -26
- data/data/ruby-advisory-db/gems/rack-cache/OSVDB-83077.yml +0 -18
- data/data/ruby-advisory-db/gems/rack-mini-profiler/CVE-2016-4442.yml +0 -17
- data/data/ruby-advisory-db/gems/rack-ssl/OSVDB-104734.yml +0 -11
- data/data/ruby-advisory-db/gems/rails-html-sanitizer/CVE-2015-7578.yml +0 -47
- data/data/ruby-advisory-db/gems/rails-html-sanitizer/CVE-2015-7579.yml +0 -75
- data/data/ruby-advisory-db/gems/rails-html-sanitizer/CVE-2015-7580.yml +0 -70
- data/data/ruby-advisory-db/gems/rbovirt/OSVDB-104080.yml +0 -20
- data/data/ruby-advisory-db/gems/rdoc/OSVDB-90004.yml +0 -27
- data/data/ruby-advisory-db/gems/redcarpet/CVE-2015-5147.yml +0 -17
- data/data/ruby-advisory-db/gems/redcarpet/OSVDB-120415.yml +0 -16
- data/data/ruby-advisory-db/gems/redis-namespace/OSVDB-96425.yml +0 -15
- data/data/ruby-advisory-db/gems/refile/OSVDB-120857.yml +0 -16
- data/data/ruby-advisory-db/gems/rest-client/CVE-2015-1820.yml +0 -23
- data/data/ruby-advisory-db/gems/rest-client/OSVDB-117461.yml +0 -13
- data/data/ruby-advisory-db/gems/rgpg/OSVDB-95948.yml +0 -15
- data/data/ruby-advisory-db/gems/ruby-saml/CVE-2016-5697.yml +0 -17
- data/data/ruby-advisory-db/gems/ruby-saml/OSVDB-117903.yml +0 -13
- data/data/ruby-advisory-db/gems/ruby-saml/OSVDB-124383.yml +0 -11
- data/data/ruby-advisory-db/gems/ruby-saml/OSVDB-124991.yml +0 -13
- data/data/ruby-advisory-db/gems/ruby_parser/OSVDB-90561.yml +0 -11
- data/data/ruby-advisory-db/gems/rubyzip/CVE-2017-5946.yml +0 -14
- data/data/ruby-advisory-db/gems/safemode/CVE-2016-3693.yml +0 -13
- data/data/ruby-advisory-db/gems/screen_capture/OSVDB-107783.yml +0 -7
- data/data/ruby-advisory-db/gems/sentry-raven/OSVDB-115654.yml +0 -14
- data/data/ruby-advisory-db/gems/sfpagent/OSVDB-105971.yml +0 -15
- data/data/ruby-advisory-db/gems/show_in_browser/OSVDB-93490.yml +0 -8
- data/data/ruby-advisory-db/gems/sidekiq/OSVDB-125675.yml +0 -9
- data/data/ruby-advisory-db/gems/sidekiq/OSVDB-125676.yml +0 -14
- data/data/ruby-advisory-db/gems/sidekiq/OSVDB-125678.yml +0 -9
- data/data/ruby-advisory-db/gems/sidekiq-pro/OSVDB-126329.yml +0 -12
- data/data/ruby-advisory-db/gems/sidekiq-pro/OSVDB-126330.yml +0 -10
- data/data/ruby-advisory-db/gems/sidekiq-pro/OSVDB-126331.yml +0 -14
- data/data/ruby-advisory-db/gems/sounder/OSVDB-96278.yml +0 -14
- data/data/ruby-advisory-db/gems/spina/CVE-2015-4619.yml +0 -16
- data/data/ruby-advisory-db/gems/spree/OSVDB-119205.yml +0 -18
- data/data/ruby-advisory-db/gems/spree/OSVDB-125699.yml +0 -18
- data/data/ruby-advisory-db/gems/spree/OSVDB-125701.yml +0 -17
- data/data/ruby-advisory-db/gems/spree/OSVDB-125712.yml +0 -16
- data/data/ruby-advisory-db/gems/spree/OSVDB-125713.yml +0 -15
- data/data/ruby-advisory-db/gems/spree/OSVDB-69098.yml +0 -19
- data/data/ruby-advisory-db/gems/spree/OSVDB-73751.yml +0 -11
- data/data/ruby-advisory-db/gems/spree/OSVDB-76011.yml +0 -15
- data/data/ruby-advisory-db/gems/spree/OSVDB-81505.yml +0 -14
- data/data/ruby-advisory-db/gems/spree/OSVDB-81506.yml +0 -16
- data/data/ruby-advisory-db/gems/spree/OSVDB-90865.yml +0 -20
- data/data/ruby-advisory-db/gems/spree/OSVDB-91216.yml +0 -17
- data/data/ruby-advisory-db/gems/spree/OSVDB-91217.yml +0 -17
- data/data/ruby-advisory-db/gems/spree/OSVDB-91218.yml +0 -17
- data/data/ruby-advisory-db/gems/spree/OSVDB-91219.yml +0 -17
- data/data/ruby-advisory-db/gems/spree_auth/OSVDB-90865.yml +0 -16
- data/data/ruby-advisory-db/gems/spree_auth_devise/OSVDB-90865.yml +0 -20
- data/data/ruby-advisory-db/gems/sprockets/CVE-2014-7819.yml +0 -27
- data/data/ruby-advisory-db/gems/sprout/OSVDB-100598.yml +0 -16
- data/data/ruby-advisory-db/gems/sup/CVE-2013-4478.yml +0 -14
- data/data/ruby-advisory-db/gems/sup/CVE-2013-4479.yml +0 -14
- data/data/ruby-advisory-db/gems/thumbshooter/OSVDB-91839.yml +0 -9
- data/data/ruby-advisory-db/gems/twitter-bootstrap-rails/OSVDB-109206.yml +0 -22
- data/data/ruby-advisory-db/gems/uglifier/OSVDB-126747.yml +0 -19
- data/data/ruby-advisory-db/gems/web-console/CVE-2015-3224.yml +0 -22
- data/data/ruby-advisory-db/gems/web-console/OSVDB-112346.yml +0 -12
- data/data/ruby-advisory-db/gems/webbynode/OSVDB-100920.yml +0 -12
- data/data/ruby-advisory-db/gems/wicked/OSVDB-98270.yml +0 -14
- data/data/ruby-advisory-db/gems/will_paginate/OSVDB-101138.yml +0 -15
- data/data/ruby-advisory-db/gems/xaviershay-dm-rails/OSVDB-118579.yml +0 -13
- data/data/ruby-advisory-db/lib/cf_scrape.py +0 -5
- data/data/ruby-advisory-db/lib/osvdb_scrape.rb +0 -92
- data/data/ruby-advisory-db/libraries/rubygems/CVE-2013-4287.yml +0 -19
- data/data/ruby-advisory-db/libraries/rubygems/CVE-2013-4363.yml +0 -20
- data/data/ruby-advisory-db/libraries/rubygems/CVE-2015-3900.yml +0 -19
- data/data/ruby-advisory-db/libraries/rubygems/CVE-2015-4020.yml +0 -19
- data/data/ruby-advisory-db/libraries/rubygems/OSVDB-33561.yml +0 -17
- data/data/ruby-advisory-db/libraries/rubygems/OSVDB-81444.yml +0 -14
- data/data/ruby-advisory-db/libraries/rubygems/OSVDB-85809.yml +0 -16
- data/data/ruby-advisory-db/rubies/jruby/CVE-2010-1330.yml +0 -17
- data/data/ruby-advisory-db/rubies/jruby/CVE-2011-4838.yml +0 -15
- data/data/ruby-advisory-db/rubies/jruby/CVE-2012-5370.yml +0 -17
- data/data/ruby-advisory-db/rubies/jruby/OSVDB-94644.yml +0 -12
- data/data/ruby-advisory-db/rubies/rbx/OSVDB-78119.yml +0 -13
- data/data/ruby-advisory-db/rubies/rbx/OSVDB-87861.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2007-5162.yml +0 -16
- data/data/ruby-advisory-db/rubies/ruby/CVE-2007-5770.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2008-1447.yml +0 -15
- data/data/ruby-advisory-db/rubies/ruby/CVE-2008-1891.yml +0 -21
- data/data/ruby-advisory-db/rubies/ruby/CVE-2008-2376.yml +0 -18
- data/data/ruby-advisory-db/rubies/ruby/CVE-2008-3443.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2008-3655.yml +0 -18
- data/data/ruby-advisory-db/rubies/ruby/CVE-2008-3656.yml +0 -19
- data/data/ruby-advisory-db/rubies/ruby/CVE-2008-3657.yml +0 -16
- data/data/ruby-advisory-db/rubies/ruby/CVE-2008-3905.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2009-0642.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2009-5147.yml +0 -13
- data/data/ruby-advisory-db/rubies/ruby/CVE-2011-0188.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2011-2686.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2011-2705.yml +0 -16
- data/data/ruby-advisory-db/rubies/ruby/CVE-2011-3009.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2012-4464.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2012-4466.yml +0 -16
- data/data/ruby-advisory-db/rubies/ruby/CVE-2012-4481.yml +0 -15
- data/data/ruby-advisory-db/rubies/ruby/CVE-2015-1855.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/CVE-2015-7551.yml +0 -19
- data/data/ruby-advisory-db/rubies/ruby/CVE-2015-9096.yml +0 -19
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-100113.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-105027.yml +0 -20
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-107478.yml +0 -16
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-108971.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-113747.yml +0 -19
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-114641.yml +0 -22
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-120541.yml +0 -22
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-46550.yml +0 -22
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-46551.yml +0 -21
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-46552.yml +0 -21
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-46553.yml +0 -22
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-46554.yml +0 -18
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-47753.yml +0 -16
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-55031.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-60880.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-61774.yml +0 -20
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-65556.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-66040.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-70957.yml +0 -15
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-70958.yml +0 -20
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-74829.yml +0 -18
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-78118.yml +0 -14
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-87280.yml +0 -17
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-87863.yml +0 -18
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-87917.yml +0 -16
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-90587.yml +0 -16
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-93414.yml +0 -19
- data/data/ruby-advisory-db/rubies/ruby/OSVDB-94628.yml +0 -21
- data/data/ruby-advisory-db/scripts/post-advisories.sh +0 -18
- data/data/ruby-advisory-db/spec/advisory_example.rb +0 -202
- data/data/ruby-advisory-db/spec/gem_example.rb +0 -22
- data/data/ruby-advisory-db/spec/gems_spec.rb +0 -23
- data/data/ruby-advisory-db/spec/library_example.rb +0 -21
- data/data/ruby-advisory-db/spec/ruby_example.rb +0 -23
- data/data/ruby-advisory-db/spec/spec_helper.rb +0 -1
- data/data/ruby-advisory-db.ts +0 -1
data/lib/bundler/audit/cli.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
4
|
# bundler-audit is free software: you can redistribute it and/or modify
|
5
5
|
# it under the terms of the GNU General Public License as published by
|
@@ -12,140 +12,166 @@
|
|
12
12
|
# GNU General Public License for more details.
|
13
13
|
#
|
14
14
|
# You should have received a copy of the GNU General Public License
|
15
|
-
# along with bundler-audit. If not, see <
|
15
|
+
# along with bundler-audit. If not, see <https://www.gnu.org/licenses/>.
|
16
16
|
#
|
17
17
|
|
18
18
|
require 'bundler/audit/scanner'
|
19
19
|
require 'bundler/audit/version'
|
20
|
+
require 'bundler/audit/cli/formats'
|
20
21
|
|
21
22
|
require 'thor'
|
23
|
+
require 'bundler/audit/cli/thor_ext/shell/basic/say_error'
|
22
24
|
require 'bundler'
|
23
|
-
require 'bundler/vendored_thor'
|
24
25
|
|
25
26
|
module Bundler
|
26
27
|
module Audit
|
28
|
+
#
|
29
|
+
# The `bundle-audit` command.
|
30
|
+
#
|
27
31
|
class CLI < ::Thor
|
28
32
|
|
29
33
|
default_task :check
|
30
34
|
map '--version' => :version
|
31
35
|
|
32
|
-
desc 'check', 'Checks the Gemfile.lock for insecure dependencies'
|
33
|
-
method_option :quiet, :
|
34
|
-
method_option :verbose, :
|
35
|
-
method_option :ignore, :
|
36
|
-
method_option :update, :
|
36
|
+
desc 'check [DIR]', 'Checks the Gemfile.lock for insecure dependencies'
|
37
|
+
method_option :quiet, type: :boolean, aliases: '-q'
|
38
|
+
method_option :verbose, type: :boolean, aliases: '-v'
|
39
|
+
method_option :ignore, type: :array, aliases: '-i'
|
40
|
+
method_option :update, type: :boolean, aliases: '-u'
|
41
|
+
method_option :database, type: :string, aliases: '-D',
|
42
|
+
default: Database::USER_PATH
|
43
|
+
method_option :format, type: :string, default: 'text', aliases: '-F'
|
44
|
+
method_option :config, type: :string, aliases: '-c', default: '.bundler-audit.yml'
|
45
|
+
method_option :gemfile_lock, type: :string, aliases: '-G',
|
46
|
+
default: 'Gemfile.lock'
|
47
|
+
method_option :output, type: :string, aliases: '-o'
|
48
|
+
|
49
|
+
def check(dir=Dir.pwd)
|
50
|
+
unless File.directory?(dir)
|
51
|
+
say_error "No such file or directory: #{dir}", :red
|
52
|
+
exit 1
|
53
|
+
end
|
37
54
|
|
38
|
-
|
39
|
-
|
55
|
+
begin
|
56
|
+
extend Formats.load(options[:format])
|
57
|
+
rescue Formats::FormatNotFound
|
58
|
+
say_error "Unknown format: #{options[:format]}", :red
|
59
|
+
exit 1
|
60
|
+
end
|
40
61
|
|
41
|
-
|
42
|
-
|
62
|
+
if !Database.exists?(options[:database])
|
63
|
+
download(options[:database])
|
64
|
+
elsif options[:update]
|
65
|
+
update(options[:database])
|
66
|
+
end
|
43
67
|
|
44
|
-
|
45
|
-
|
68
|
+
database = Database.new(options[:database])
|
69
|
+
scanner = begin
|
70
|
+
Scanner.new(dir,options[:gemfile_lock],database, options[:config])
|
71
|
+
rescue Bundler::GemfileLockNotFound => exception
|
72
|
+
say exception.message, :red
|
73
|
+
exit 1
|
74
|
+
end
|
46
75
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
76
|
+
report = scanner.report(ignore: options.ignore)
|
77
|
+
|
78
|
+
output = if options[:output] then File.new(options[:output],'w')
|
79
|
+
else $stdout
|
80
|
+
end
|
81
|
+
|
82
|
+
print_report(report,output)
|
83
|
+
|
84
|
+
output.close if options[:output]
|
85
|
+
|
86
|
+
exit(1) if report.vulnerable?
|
87
|
+
end
|
88
|
+
|
89
|
+
desc 'stats', 'Prints ruby-advisory-db stats'
|
90
|
+
method_option :quiet, type: :boolean, aliases: '-q'
|
91
|
+
|
92
|
+
def stats(path=Database.path)
|
93
|
+
database = Database.new(path)
|
94
|
+
|
95
|
+
puts "ruby-advisory-db:"
|
96
|
+
puts " advisories:\t#{database.size} advisories"
|
97
|
+
puts " last updated:\t#{database.last_updated_at}"
|
98
|
+
|
99
|
+
if (commit_id = database.commit_id)
|
100
|
+
puts " commit:\t#{commit_id}"
|
53
101
|
end
|
102
|
+
end
|
103
|
+
|
104
|
+
desc 'download', 'Downloads ruby-advisory-db'
|
105
|
+
method_option :quiet, type: :boolean, aliases: '-q'
|
54
106
|
|
55
|
-
|
56
|
-
|
107
|
+
def download(path=Database.path)
|
108
|
+
if Database.exists?(path)
|
109
|
+
say "Database already exists", :yellow
|
110
|
+
return
|
111
|
+
end
|
112
|
+
|
113
|
+
say("Download ruby-advisory-db ...") unless options.quiet?
|
114
|
+
|
115
|
+
begin
|
116
|
+
Database.download(path: path, quiet: options.quiet?)
|
117
|
+
rescue Database::DownloadFailed => error
|
118
|
+
say error.message, :red
|
57
119
|
exit 1
|
58
|
-
else
|
59
|
-
say("No vulnerabilities found", :green) unless options.quiet?
|
60
120
|
end
|
121
|
+
|
122
|
+
stats(path) unless options.quiet?
|
61
123
|
end
|
62
124
|
|
63
125
|
desc 'update', 'Updates the ruby-advisory-db'
|
64
|
-
method_option :quiet, :
|
126
|
+
method_option :quiet, type: :boolean, aliases: '-q'
|
127
|
+
|
128
|
+
def update(path=Database.path)
|
129
|
+
unless Database.exists?(path)
|
130
|
+
download(path)
|
131
|
+
return
|
132
|
+
end
|
65
133
|
|
66
|
-
def update
|
67
134
|
say("Updating ruby-advisory-db ...") unless options.quiet?
|
68
135
|
|
69
|
-
|
136
|
+
database = Database.new(path)
|
137
|
+
|
138
|
+
case database.update!(quiet: options.quiet?)
|
70
139
|
when true
|
71
140
|
say("Updated ruby-advisory-db", :green) unless options.quiet?
|
72
141
|
when false
|
73
|
-
|
142
|
+
say_error "Failed updating ruby-advisory-db!", :red
|
74
143
|
exit 1
|
75
144
|
when nil
|
145
|
+
unless Bundler.git_present?
|
146
|
+
say_error "Git is not installed!", :red
|
147
|
+
exit 1
|
148
|
+
end
|
149
|
+
|
76
150
|
say "Skipping update", :yellow
|
77
151
|
end
|
78
152
|
|
79
|
-
unless options.quiet?
|
80
|
-
puts("ruby-advisory-db: #{Database.new.size} advisories")
|
81
|
-
end
|
153
|
+
stats(path) unless options.quiet?
|
82
154
|
end
|
83
155
|
|
84
156
|
desc 'version', 'Prints the bundler-audit version'
|
85
157
|
def version
|
86
|
-
|
87
|
-
|
88
|
-
puts "#{File.basename($0)} #{VERSION} (advisories: #{database.size})"
|
158
|
+
puts "bundler-audit #{VERSION}"
|
89
159
|
end
|
90
160
|
|
91
161
|
protected
|
92
162
|
|
93
|
-
|
94
|
-
|
95
|
-
|
163
|
+
#
|
164
|
+
# @note Silence deprecation warnings from Thor.
|
165
|
+
#
|
166
|
+
def self.exit_on_failure?
|
167
|
+
true
|
96
168
|
end
|
97
169
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
say "Name: ", :red
|
104
|
-
say gem.name
|
105
|
-
|
106
|
-
say "Version: ", :red
|
107
|
-
say gem.version
|
108
|
-
|
109
|
-
say "Advisory: ", :red
|
110
|
-
|
111
|
-
if advisory.cve
|
112
|
-
say "CVE-#{advisory.cve}"
|
113
|
-
elsif advisory.osvdb
|
114
|
-
say advisory.osvdb
|
115
|
-
end
|
116
|
-
|
117
|
-
say "Criticality: ", :red
|
118
|
-
case advisory.criticality
|
119
|
-
when :low then say "Low"
|
120
|
-
when :medium then say "Medium", :yellow
|
121
|
-
when :high then say "High", [:red, :bold]
|
122
|
-
else say "Unknown"
|
123
|
-
end
|
124
|
-
|
125
|
-
say "URL: ", :red
|
126
|
-
say advisory.url
|
127
|
-
|
128
|
-
if options.verbose?
|
129
|
-
say "Description:", :red
|
130
|
-
say
|
131
|
-
|
132
|
-
print_wrapped advisory.description, :indent => 2
|
133
|
-
say
|
134
|
-
else
|
135
|
-
|
136
|
-
say "Title: ", :red
|
137
|
-
say advisory.title
|
138
|
-
end
|
139
|
-
|
140
|
-
unless advisory.patched_versions.empty?
|
141
|
-
say "Solution: upgrade to ", :red
|
142
|
-
say advisory.patched_versions.join(', ')
|
143
|
-
else
|
144
|
-
say "Solution: ", :red
|
145
|
-
say "remove or disable this gem until a patch is available!", [:red, :bold]
|
146
|
-
end
|
147
|
-
|
148
|
-
say
|
170
|
+
#
|
171
|
+
# @abstract
|
172
|
+
#
|
173
|
+
def print_report(report)
|
174
|
+
raise(NotImplementedError,"#{self.class}##{__method__} not defined")
|
149
175
|
end
|
150
176
|
|
151
177
|
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
#
|
4
|
+
# bundler-audit is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# bundler-audit is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with bundler-audit. If not, see <https://www.gnu.org/licenses/>.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'yaml'
|
19
|
+
require 'set'
|
20
|
+
|
21
|
+
module Bundler
|
22
|
+
module Audit
|
23
|
+
#
|
24
|
+
# Class for storing and validating configuration for running the auditor.
|
25
|
+
#
|
26
|
+
# @since 0.8.0
|
27
|
+
#
|
28
|
+
class Configuration
|
29
|
+
class InvalidConfigurationError < StandardError
|
30
|
+
end
|
31
|
+
|
32
|
+
class FileNotFound < StandardError
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# A constructor method for loading configuration from a YAML file.
|
37
|
+
#
|
38
|
+
# @param [String] file_path
|
39
|
+
# Path to the YAML file holding the configuration.
|
40
|
+
#
|
41
|
+
# @raise [FileNotFound]
|
42
|
+
# Will raise a file not found error when the path to the
|
43
|
+
# configuration YAML file does not exist.
|
44
|
+
#
|
45
|
+
# @raise [InvalidConfigurationError]
|
46
|
+
# Will raise an invalid configuration error indicating what in the
|
47
|
+
# YAML file is invalid for the configuration.
|
48
|
+
#
|
49
|
+
# @return [Configuration]
|
50
|
+
# A Configuration object containing the config hash loaded from the
|
51
|
+
# file passed.
|
52
|
+
#
|
53
|
+
def self.load(file_path)
|
54
|
+
raise(FileNotFound,"Configuration file '#{file_path}' does not exist") unless File.exist?(file_path)
|
55
|
+
|
56
|
+
doc = YAML.parse(File.new(file_path))
|
57
|
+
|
58
|
+
unless doc.kind_of?(YAML::Nodes::Document)
|
59
|
+
raise(InvalidConfigurationError,"Configuration found in '#{file_path}' is not YAML")
|
60
|
+
end
|
61
|
+
|
62
|
+
unless doc.root.kind_of?(YAML::Nodes::Mapping)
|
63
|
+
raise(InvalidConfigurationError,"Configuration found in '#{file_path}' is not a Hash")
|
64
|
+
end
|
65
|
+
|
66
|
+
config = {}
|
67
|
+
|
68
|
+
doc.root.children.each_slice(2) do |key,value|
|
69
|
+
case key.value
|
70
|
+
when 'ignore'
|
71
|
+
unless value.is_a?(YAML::Nodes::Sequence)
|
72
|
+
raise(InvalidConfigurationError,"'ignore' key found in config file, but is not an Array")
|
73
|
+
end
|
74
|
+
|
75
|
+
unless value.children.all? { |node| node.is_a?(YAML::Nodes::Scalar) }
|
76
|
+
raise(InvalidConfigurationError,"'ignore' array in config file contains a non-String")
|
77
|
+
end
|
78
|
+
|
79
|
+
config[:ignore] = value.children.map(&:value)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
new(config)
|
84
|
+
end
|
85
|
+
|
86
|
+
#
|
87
|
+
# The list of advisory IDs to ignore.
|
88
|
+
#
|
89
|
+
# @return [Set<String>]
|
90
|
+
#
|
91
|
+
attr_reader :ignore
|
92
|
+
|
93
|
+
#
|
94
|
+
# Initializes the configuration.
|
95
|
+
#
|
96
|
+
# @param [Hash] config
|
97
|
+
# The configuration hash.
|
98
|
+
#
|
99
|
+
# @option config [Array<String>] :ignore
|
100
|
+
# The list of advisory IDs to ignore.
|
101
|
+
#
|
102
|
+
def initialize(config={})
|
103
|
+
@ignore = Set.new(config[:ignore])
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
4
|
# bundler-audit is free software: you can redistribute it and/or modify
|
5
5
|
# it under the terms of the GNU General Public License as published by
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# GNU General Public License for more details.
|
13
13
|
#
|
14
14
|
# You should have received a copy of the GNU General Public License
|
15
|
-
# along with bundler-audit. If not, see <
|
15
|
+
# along with bundler-audit. If not, see <https://www.gnu.org/licenses/>.
|
16
16
|
#
|
17
17
|
|
18
18
|
require 'bundler/audit/advisory'
|
@@ -28,17 +28,22 @@ module Bundler
|
|
28
28
|
#
|
29
29
|
class Database
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
class DownloadFailed < RuntimeError
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
class UpdateFailed < RuntimeError
|
35
|
+
end
|
36
36
|
|
37
|
-
#
|
38
|
-
|
37
|
+
# Git URL of the ruby-advisory-db
|
38
|
+
URL = 'https://github.com/rubysec/ruby-advisory-db.git'
|
39
39
|
|
40
40
|
# Path to the user's copy of the ruby-advisory-db
|
41
|
-
USER_PATH = File.expand_path(File.join(
|
41
|
+
USER_PATH = File.expand_path(File.join(Gem.user_home,'.local','share','ruby-advisory-db'))
|
42
|
+
|
43
|
+
# Default path to the ruby-advisory-db
|
44
|
+
#
|
45
|
+
# @since 0.8.0
|
46
|
+
DEFAULT_PATH = ENV['BUNDLER_AUDIT_DB'] || USER_PATH
|
42
47
|
|
43
48
|
# The path to the advisory database
|
44
49
|
attr_reader :path
|
@@ -67,49 +72,176 @@ module Bundler
|
|
67
72
|
# The path to the database directory.
|
68
73
|
#
|
69
74
|
def self.path
|
70
|
-
|
71
|
-
|
72
|
-
t2 = VENDORED_TIMESTAMP
|
75
|
+
DEFAULT_PATH
|
76
|
+
end
|
73
77
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
78
|
+
#
|
79
|
+
# Tests whether the database exists.
|
80
|
+
#
|
81
|
+
# @param [String] path
|
82
|
+
# The given path of the database to check.
|
83
|
+
#
|
84
|
+
# @return [Boolean]
|
85
|
+
#
|
86
|
+
# @since 0.8.0
|
87
|
+
#
|
88
|
+
def self.exists?(path=DEFAULT_PATH)
|
89
|
+
File.directory?(path) && !(Dir.entries(path) - %w[. ..]).empty?
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
# Downloads the ruby-advisory-db.
|
94
|
+
#
|
95
|
+
# @param [Hash] options
|
96
|
+
# Additional options.
|
97
|
+
#
|
98
|
+
# @option options [String] :path (DEFAULT_PATH)
|
99
|
+
# The destination path for the new ruby-advisory-db.
|
100
|
+
#
|
101
|
+
# @option options [Boolean] :quiet
|
102
|
+
# Specify whether `git` should be `--quiet`.
|
103
|
+
#
|
104
|
+
# @return [Dataase]
|
105
|
+
# The newly downloaded database.
|
106
|
+
#
|
107
|
+
# @raise [DownloadFailed]
|
108
|
+
# Indicates that the download failed.
|
109
|
+
#
|
110
|
+
# @note
|
111
|
+
# Requires network access.
|
112
|
+
#
|
113
|
+
# @since 0.8.0
|
114
|
+
#
|
115
|
+
def self.download(options={})
|
116
|
+
unless (options.keys - [:path, :quiet]).empty?
|
117
|
+
raise(ArgumentError,"Invalid option(s)")
|
118
|
+
end
|
119
|
+
|
120
|
+
path = options.fetch(:path,DEFAULT_PATH)
|
121
|
+
|
122
|
+
command = %w[git clone]
|
123
|
+
command << '--quiet' if options[:quiet]
|
124
|
+
command << URL << path
|
125
|
+
|
126
|
+
unless system(*command)
|
127
|
+
raise(DownloadFailed,"failed to download #{URL} to #{path.inspect}")
|
79
128
|
end
|
129
|
+
|
130
|
+
return new(path)
|
80
131
|
end
|
81
132
|
|
82
133
|
#
|
83
134
|
# Updates the ruby-advisory-db.
|
84
135
|
#
|
85
|
-
# @param [
|
136
|
+
# @param [Hash] options
|
137
|
+
# Additional options.
|
138
|
+
#
|
139
|
+
# @option options [Boolean] :quiet
|
86
140
|
# Specify whether `git` should be `--quiet`.
|
87
141
|
#
|
88
142
|
# @return [Boolean, nil]
|
89
143
|
# Specifies whether the update was successful.
|
90
144
|
# A `nil` indicates no update was performed.
|
91
145
|
#
|
146
|
+
# @raise [ArgumentError]
|
147
|
+
# Invalid options were given.
|
148
|
+
#
|
92
149
|
# @note
|
93
150
|
# Requires network access.
|
94
151
|
#
|
95
152
|
# @since 0.3.0
|
96
153
|
#
|
154
|
+
# @deprecated Use {#update!} instead.
|
155
|
+
#
|
97
156
|
def self.update!(options={})
|
98
157
|
raise "Invalid option(s)" unless (options.keys - [:quiet]).empty?
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
158
|
+
|
159
|
+
if File.directory?(DEFAULT_PATH)
|
160
|
+
begin
|
161
|
+
new(DEFAULT_PATH).update!(options)
|
162
|
+
rescue UpdateFailed then false
|
163
|
+
end
|
164
|
+
else
|
165
|
+
begin
|
166
|
+
download(options.merge(path: DEFAULT_PATH))
|
167
|
+
rescue DownloadFailed then false
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
#
|
173
|
+
# Determines if the database is a git repository.
|
174
|
+
#
|
175
|
+
# @return [Boolean]
|
176
|
+
#
|
177
|
+
# @since 0.8.0
|
178
|
+
#
|
179
|
+
def git?
|
180
|
+
File.directory?(File.join(@path,'.git'))
|
181
|
+
end
|
182
|
+
|
183
|
+
#
|
184
|
+
# Updates the ruby-advisory-db.
|
185
|
+
#
|
186
|
+
# @param [Hash] options
|
187
|
+
# Additional options.
|
188
|
+
#
|
189
|
+
# @option options [Boolean] :quiet
|
190
|
+
# Specify whether `git` should be `--quiet`.
|
191
|
+
#
|
192
|
+
# @return [true, nil]
|
193
|
+
# `true` indicates that the update was successful.
|
194
|
+
# `nil` indicates the database is not a git repository, thus not
|
195
|
+
# capable of being updated.
|
196
|
+
#
|
197
|
+
# @since 0.8.0
|
198
|
+
#
|
199
|
+
def update!(options={})
|
200
|
+
if git?
|
201
|
+
Dir.chdir(@path) do
|
202
|
+
command = %w[git pull]
|
203
|
+
command << '--quiet' if options[:quiet]
|
204
|
+
command << 'origin' << 'master'
|
205
|
+
|
206
|
+
unless system(*command)
|
207
|
+
raise(UpdateFailed,"failed to update #{@path.inspect}")
|
106
208
|
end
|
209
|
+
|
210
|
+
return true
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
#
|
216
|
+
# The last commit ID of the repository.
|
217
|
+
#
|
218
|
+
# @return [String, nil]
|
219
|
+
# The commit hash or `nil` if the database is not a git repository.
|
220
|
+
#
|
221
|
+
# @since 0.9.0
|
222
|
+
#
|
223
|
+
def commit_id
|
224
|
+
if git?
|
225
|
+
Dir.chdir(@path) do
|
226
|
+
`git rev-parse HEAD`.chomp
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
#
|
232
|
+
# Determines the time when the database was last updated.
|
233
|
+
#
|
234
|
+
# @return [Time]
|
235
|
+
#
|
236
|
+
# @since 0.8.0
|
237
|
+
#
|
238
|
+
def last_updated_at
|
239
|
+
if git?
|
240
|
+
Dir.chdir(@path) do
|
241
|
+
Time.parse(`git log --date=iso8601 --pretty="%cd" -1`)
|
107
242
|
end
|
108
243
|
else
|
109
|
-
|
110
|
-
command << '--quiet' if options[:quiet]
|
111
|
-
command << URL << USER_PATH
|
112
|
-
system *command
|
244
|
+
File.mtime(@path)
|
113
245
|
end
|
114
246
|
end
|
115
247
|
|