bundler-audit 0.8.0 → 0.9.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug-report.md +44 -0
  3. data/.github/workflows/ruby.yml +14 -1
  4. data/.rubocop.yml +83 -0
  5. data/COPYING.txt +4 -4
  6. data/ChangeLog.md +30 -0
  7. data/Gemfile +7 -3
  8. data/README.md +16 -10
  9. data/Rakefile +7 -3
  10. data/bundler-audit.gemspec +3 -4
  11. data/lib/bundler/audit/advisory.rb +23 -2
  12. data/lib/bundler/audit/cli/formats/json.rb +16 -2
  13. data/lib/bundler/audit/cli/formats/junit.rb +127 -0
  14. data/lib/bundler/audit/cli/formats/text.rb +11 -7
  15. data/lib/bundler/audit/cli/formats.rb +7 -3
  16. data/lib/bundler/audit/cli.rb +32 -15
  17. data/lib/bundler/audit/configuration.rb +7 -4
  18. data/lib/bundler/audit/database.rb +20 -4
  19. data/lib/bundler/audit/results/insecure_source.rb +4 -1
  20. data/lib/bundler/audit/results/unpatched_gem.rb +6 -2
  21. data/lib/bundler/audit/results.rb +1 -1
  22. data/lib/bundler/audit/scanner.rb +8 -2
  23. data/lib/bundler/audit/task.rb +20 -5
  24. data/lib/bundler/audit/version.rb +2 -2
  25. data/lib/bundler/audit.rb +1 -1
  26. data/spec/advisory_spec.rb +9 -1
  27. data/spec/bundle/insecure_sources/Gemfile.lock +69 -71
  28. data/spec/bundle/secure/Gemfile.lock +51 -53
  29. data/spec/cli/formats/json_spec.rb +1 -0
  30. data/spec/cli/formats/junit_spec.rb +284 -0
  31. data/spec/cli/formats/text_spec.rb +87 -17
  32. data/spec/cli_spec.rb +57 -17
  33. data/spec/database_spec.rb +25 -1
  34. data/spec/fixtures/advisory/CVE-2020-1234.yml +1 -0
  35. data/spec/fixtures/lib/bundler/audit/cli/formats/bad.rb +0 -2
  36. data/spec/fixtures/lib/bundler/audit/cli/formats/good.rb +0 -2
  37. data/spec/results/unpatched_gem_spec.rb +2 -2
  38. data/spec/scanner_spec.rb +25 -1
  39. data/spec/spec_helper.rb +5 -1
  40. metadata +10 -6
@@ -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 <http://www.gnu.org/licenses/>.
15
+ # along with bundler-audit. If not, see <https://www.gnu.org/licenses/>.
16
16
  #
17
17
 
18
18
  require 'bundler/audit/results/insecure_source'
@@ -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 <http://www.gnu.org/licenses/>.
15
+ # along with bundler-audit. If not, see <https://www.gnu.org/licenses/>.
16
16
  #
17
17
 
18
18
  require 'bundler'
@@ -31,6 +31,9 @@ require 'yaml'
31
31
 
32
32
  module Bundler
33
33
  module Audit
34
+ #
35
+ # Scans a `Gemfile.lock` for security issues.
36
+ #
34
37
  class Scanner
35
38
 
36
39
  # The advisory database
@@ -63,6 +66,9 @@ module Bundler
63
66
  # @param [Database] database
64
67
  # The database to scan against.
65
68
  #
69
+ # @param [String] config_dot_file
70
+ # The file name of the bundler-audit config file.
71
+ #
66
72
  # @raise [Bundler::GemfileLockNotFound]
67
73
  # The `gemfile_lock` file could not be found within the `root`
68
74
  # directory.
@@ -79,7 +85,7 @@ module Bundler
79
85
 
80
86
  @lockfile = LockfileParser.new(File.read(gemfile_lock_path))
81
87
 
82
- config_dot_file_full_path = File.join(@root,config_dot_file)
88
+ config_dot_file_full_path = File.absolute_path(config_dot_file, @root)
83
89
 
84
90
  @config = if File.exist?(config_dot_file_full_path)
85
91
  Configuration.load(config_dot_file_full_path)
@@ -2,6 +2,9 @@ require 'rake/tasklib'
2
2
 
3
3
  module Bundler
4
4
  module Audit
5
+ #
6
+ # Defines the `bundle:audit` rake tasks.
7
+ #
5
8
  class Task < Rake::TaskLib
6
9
  #
7
10
  # Initializes the task.
@@ -13,16 +16,28 @@ module Bundler
13
16
  protected
14
17
 
15
18
  #
16
- # Defines the `bundle:audit` task.
19
+ # Defines the `bundle:audit` and `bundle:audit:update` task.
17
20
  #
18
21
  def define
19
22
  namespace :bundle do
20
- desc 'Checks the Gemfile.lock for insecure dependencies'
21
- task :audit do
22
- require 'bundler/audit/cli'
23
- Bundler::Audit::CLI.start %w[check]
23
+ namespace :audit do
24
+ desc 'Checks the Gemfile.lock for insecure dependencies'
25
+ task :check do
26
+ system 'bundler-audit', 'check'
27
+ end
28
+
29
+ desc 'Updates the bundler-audit vulnerability database'
30
+ task :update do
31
+ system 'bundler-audit', 'update'
32
+ end
24
33
  end
34
+
35
+ task :audit => 'audit:check'
25
36
  end
37
+
38
+ task 'bundler:audit' => 'bundle:audit'
39
+ task 'bundler:audit:check' => 'bundle:audit:check'
40
+ task 'bundler:audit:update' => 'bundle:audit:update'
26
41
  end
27
42
  end
28
43
  end
@@ -12,12 +12,12 @@
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 <http://www.gnu.org/licenses/>.
15
+ # along with bundler-audit. If not, see <https://www.gnu.org/licenses/>.
16
16
  #
17
17
 
18
18
  module Bundler
19
19
  module Audit
20
20
  # bundler-audit version
21
- VERSION = '0.8.0'
21
+ VERSION = '0.9.0.1'
22
22
  end
23
23
  end
data/lib/bundler/audit.rb CHANGED
@@ -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 <http://www.gnu.org/licenses/>.
15
+ # along with bundler-audit. If not, see <https://www.gnu.org/licenses/>.
16
16
  #
17
17
 
18
18
  require 'bundler/audit/database'
@@ -83,7 +83,7 @@ describe Bundler::Audit::Advisory do
83
83
  end
84
84
 
85
85
  context "YAML data not representing a hash" do
86
- let(:path ) do
86
+ let(:path) do
87
87
  File.expand_path('../fixtures/advisory/not_a_hash.yml', __FILE__)
88
88
  end
89
89
 
@@ -353,4 +353,12 @@ describe Bundler::Audit::Advisory do
353
353
  end
354
354
  end
355
355
  end
356
+
357
+ describe "#to_h" do
358
+ subject { super().to_h }
359
+
360
+ it "must include criticality: :critical" do
361
+ expect(subject[:criticality]).to be :critical
362
+ end
363
+ end
356
364
  end
@@ -10,122 +10,120 @@ GIT
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- actioncable (6.1.0)
14
- actionpack (= 6.1.0)
15
- activesupport (= 6.1.0)
13
+ actioncable (6.1.3.2)
14
+ actionpack (= 6.1.3.2)
15
+ activesupport (= 6.1.3.2)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
- actionmailbox (6.1.0)
19
- actionpack (= 6.1.0)
20
- activejob (= 6.1.0)
21
- activerecord (= 6.1.0)
22
- activestorage (= 6.1.0)
23
- activesupport (= 6.1.0)
18
+ actionmailbox (6.1.3.2)
19
+ actionpack (= 6.1.3.2)
20
+ activejob (= 6.1.3.2)
21
+ activerecord (= 6.1.3.2)
22
+ activestorage (= 6.1.3.2)
23
+ activesupport (= 6.1.3.2)
24
24
  mail (>= 2.7.1)
25
- actionmailer (6.1.0)
26
- actionpack (= 6.1.0)
27
- actionview (= 6.1.0)
28
- activejob (= 6.1.0)
29
- activesupport (= 6.1.0)
25
+ actionmailer (6.1.3.2)
26
+ actionpack (= 6.1.3.2)
27
+ actionview (= 6.1.3.2)
28
+ activejob (= 6.1.3.2)
29
+ activesupport (= 6.1.3.2)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  rails-dom-testing (~> 2.0)
32
- actionpack (6.1.0)
33
- actionview (= 6.1.0)
34
- activesupport (= 6.1.0)
32
+ actionpack (6.1.3.2)
33
+ actionview (= 6.1.3.2)
34
+ activesupport (= 6.1.3.2)
35
35
  rack (~> 2.0, >= 2.0.9)
36
36
  rack-test (>= 0.6.3)
37
37
  rails-dom-testing (~> 2.0)
38
38
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
39
- actiontext (6.1.0)
40
- actionpack (= 6.1.0)
41
- activerecord (= 6.1.0)
42
- activestorage (= 6.1.0)
43
- activesupport (= 6.1.0)
39
+ actiontext (6.1.3.2)
40
+ actionpack (= 6.1.3.2)
41
+ activerecord (= 6.1.3.2)
42
+ activestorage (= 6.1.3.2)
43
+ activesupport (= 6.1.3.2)
44
44
  nokogiri (>= 1.8.5)
45
- actionview (6.1.0)
46
- activesupport (= 6.1.0)
45
+ actionview (6.1.3.2)
46
+ activesupport (= 6.1.3.2)
47
47
  builder (~> 3.1)
48
48
  erubi (~> 1.4)
49
49
  rails-dom-testing (~> 2.0)
50
50
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
51
- activejob (6.1.0)
52
- activesupport (= 6.1.0)
51
+ activejob (6.1.3.2)
52
+ activesupport (= 6.1.3.2)
53
53
  globalid (>= 0.3.6)
54
- activemodel (6.1.0)
55
- activesupport (= 6.1.0)
56
- activerecord (6.1.0)
57
- activemodel (= 6.1.0)
58
- activesupport (= 6.1.0)
59
- activestorage (6.1.0)
60
- actionpack (= 6.1.0)
61
- activejob (= 6.1.0)
62
- activerecord (= 6.1.0)
63
- activesupport (= 6.1.0)
64
- marcel (~> 0.3.1)
65
- mimemagic (~> 0.3.2)
66
- activesupport (6.1.0)
54
+ activemodel (6.1.3.2)
55
+ activesupport (= 6.1.3.2)
56
+ activerecord (6.1.3.2)
57
+ activemodel (= 6.1.3.2)
58
+ activesupport (= 6.1.3.2)
59
+ activestorage (6.1.3.2)
60
+ actionpack (= 6.1.3.2)
61
+ activejob (= 6.1.3.2)
62
+ activerecord (= 6.1.3.2)
63
+ activesupport (= 6.1.3.2)
64
+ marcel (~> 1.0.0)
65
+ mini_mime (~> 1.0.2)
66
+ activesupport (6.1.3.2)
67
67
  concurrent-ruby (~> 1.0, >= 1.0.2)
68
68
  i18n (>= 1.6, < 2)
69
69
  minitest (>= 5.1)
70
70
  tzinfo (~> 2.0)
71
71
  zeitwerk (~> 2.3)
72
72
  builder (3.2.4)
73
- concurrent-ruby (1.1.7)
73
+ concurrent-ruby (1.1.8)
74
74
  crass (1.0.6)
75
75
  erubi (1.10.0)
76
76
  globalid (0.4.2)
77
77
  activesupport (>= 4.2.0)
78
- i18n (1.8.5)
78
+ i18n (1.8.10)
79
79
  concurrent-ruby (~> 1.0)
80
- loofah (2.8.0)
80
+ loofah (2.9.1)
81
81
  crass (~> 1.0.2)
82
82
  nokogiri (>= 1.5.9)
83
83
  mail (2.7.1)
84
84
  mini_mime (>= 0.1.1)
85
- marcel (0.3.3)
86
- mimemagic (~> 0.3.2)
85
+ marcel (1.0.1)
87
86
  method_source (1.0.0)
88
- mimemagic (0.3.5)
89
- mini_mime (1.0.2)
90
- mini_portile2 (2.5.0)
91
- minitest (5.14.2)
92
- nio4r (2.5.4)
93
- nokogiri (1.11.1)
87
+ mini_mime (1.0.3)
88
+ mini_portile2 (2.5.1)
89
+ minitest (5.14.4)
90
+ nio4r (2.5.7)
91
+ nokogiri (1.11.6)
94
92
  mini_portile2 (~> 2.5.0)
95
93
  racc (~> 1.4)
96
- nokogiri (1.11.1-x86_64-linux)
94
+ nokogiri (1.11.6-x86_64-linux)
97
95
  racc (~> 1.4)
98
96
  racc (1.5.2)
99
97
  rack (2.2.3)
100
98
  rack-test (1.1.0)
101
99
  rack (>= 1.0, < 3)
102
- rails (6.1.0)
103
- actioncable (= 6.1.0)
104
- actionmailbox (= 6.1.0)
105
- actionmailer (= 6.1.0)
106
- actionpack (= 6.1.0)
107
- actiontext (= 6.1.0)
108
- actionview (= 6.1.0)
109
- activejob (= 6.1.0)
110
- activemodel (= 6.1.0)
111
- activerecord (= 6.1.0)
112
- activestorage (= 6.1.0)
113
- activesupport (= 6.1.0)
100
+ rails (6.1.3.2)
101
+ actioncable (= 6.1.3.2)
102
+ actionmailbox (= 6.1.3.2)
103
+ actionmailer (= 6.1.3.2)
104
+ actionpack (= 6.1.3.2)
105
+ actiontext (= 6.1.3.2)
106
+ actionview (= 6.1.3.2)
107
+ activejob (= 6.1.3.2)
108
+ activemodel (= 6.1.3.2)
109
+ activerecord (= 6.1.3.2)
110
+ activestorage (= 6.1.3.2)
111
+ activesupport (= 6.1.3.2)
114
112
  bundler (>= 1.15.0)
115
- railties (= 6.1.0)
113
+ railties (= 6.1.3.2)
116
114
  sprockets-rails (>= 2.0.0)
117
115
  rails-dom-testing (2.0.3)
118
116
  activesupport (>= 4.2.0)
119
117
  nokogiri (>= 1.6)
120
118
  rails-html-sanitizer (1.3.0)
121
119
  loofah (~> 2.3)
122
- railties (6.1.0)
123
- actionpack (= 6.1.0)
124
- activesupport (= 6.1.0)
120
+ railties (6.1.3.2)
121
+ actionpack (= 6.1.3.2)
122
+ activesupport (= 6.1.3.2)
125
123
  method_source
126
124
  rake (>= 0.8.7)
127
125
  thor (~> 1.0)
128
- rake (13.0.1)
126
+ rake (13.0.3)
129
127
  sprockets (4.0.2)
130
128
  concurrent-ruby (~> 1.0)
131
129
  rack (> 1, < 3)
@@ -133,10 +131,10 @@ GEM
133
131
  actionpack (>= 4.0)
134
132
  activesupport (>= 4.0)
135
133
  sprockets (>= 3.0.0)
136
- thor (1.0.1)
137
- tzinfo (2.0.3)
134
+ thor (1.1.0)
135
+ tzinfo (2.0.4)
138
136
  concurrent-ruby (~> 1.0)
139
- websocket-driver (0.7.3)
137
+ websocket-driver (0.7.4)
140
138
  websocket-extensions (>= 0.1.0)
141
139
  websocket-extensions (0.1.5)
142
140
  zeitwerk (2.4.2)
@@ -1,103 +1,101 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- actioncable (5.2.4.4)
5
- actionpack (= 5.2.4.4)
4
+ actioncable (5.2.6)
5
+ actionpack (= 5.2.6)
6
6
  nio4r (~> 2.0)
7
7
  websocket-driver (>= 0.6.1)
8
- actionmailer (5.2.4.4)
9
- actionpack (= 5.2.4.4)
10
- actionview (= 5.2.4.4)
11
- activejob (= 5.2.4.4)
8
+ actionmailer (5.2.6)
9
+ actionpack (= 5.2.6)
10
+ actionview (= 5.2.6)
11
+ activejob (= 5.2.6)
12
12
  mail (~> 2.5, >= 2.5.4)
13
13
  rails-dom-testing (~> 2.0)
14
- actionpack (5.2.4.4)
15
- actionview (= 5.2.4.4)
16
- activesupport (= 5.2.4.4)
14
+ actionpack (5.2.6)
15
+ actionview (= 5.2.6)
16
+ activesupport (= 5.2.6)
17
17
  rack (~> 2.0, >= 2.0.8)
18
18
  rack-test (>= 0.6.3)
19
19
  rails-dom-testing (~> 2.0)
20
20
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
- actionview (5.2.4.4)
22
- activesupport (= 5.2.4.4)
21
+ actionview (5.2.6)
22
+ activesupport (= 5.2.6)
23
23
  builder (~> 3.1)
24
24
  erubi (~> 1.4)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
- activejob (5.2.4.4)
28
- activesupport (= 5.2.4.4)
27
+ activejob (5.2.6)
28
+ activesupport (= 5.2.6)
29
29
  globalid (>= 0.3.6)
30
- activemodel (5.2.4.4)
31
- activesupport (= 5.2.4.4)
32
- activerecord (5.2.4.4)
33
- activemodel (= 5.2.4.4)
34
- activesupport (= 5.2.4.4)
30
+ activemodel (5.2.6)
31
+ activesupport (= 5.2.6)
32
+ activerecord (5.2.6)
33
+ activemodel (= 5.2.6)
34
+ activesupport (= 5.2.6)
35
35
  arel (>= 9.0)
36
- activestorage (5.2.4.4)
37
- actionpack (= 5.2.4.4)
38
- activerecord (= 5.2.4.4)
39
- marcel (~> 0.3.1)
40
- activesupport (5.2.4.4)
36
+ activestorage (5.2.6)
37
+ actionpack (= 5.2.6)
38
+ activerecord (= 5.2.6)
39
+ marcel (~> 1.0.0)
40
+ activesupport (5.2.6)
41
41
  concurrent-ruby (~> 1.0, >= 1.0.2)
42
42
  i18n (>= 0.7, < 2)
43
43
  minitest (~> 5.1)
44
44
  tzinfo (~> 1.1)
45
45
  arel (9.0.0)
46
46
  builder (3.2.4)
47
- concurrent-ruby (1.1.7)
47
+ concurrent-ruby (1.1.8)
48
48
  crass (1.0.6)
49
49
  erubi (1.10.0)
50
50
  globalid (0.4.2)
51
51
  activesupport (>= 4.2.0)
52
- i18n (1.8.5)
52
+ i18n (1.8.10)
53
53
  concurrent-ruby (~> 1.0)
54
- loofah (2.8.0)
54
+ loofah (2.9.1)
55
55
  crass (~> 1.0.2)
56
56
  nokogiri (>= 1.5.9)
57
57
  mail (2.7.1)
58
58
  mini_mime (>= 0.1.1)
59
- marcel (0.3.3)
60
- mimemagic (~> 0.3.2)
59
+ marcel (1.0.1)
61
60
  method_source (1.0.0)
62
- mimemagic (0.3.5)
63
- mini_mime (1.0.2)
64
- mini_portile2 (2.5.0)
65
- minitest (5.14.2)
66
- nio4r (2.5.4)
67
- nokogiri (1.11.1)
61
+ mini_mime (1.1.0)
62
+ mini_portile2 (2.5.1)
63
+ minitest (5.14.4)
64
+ nio4r (2.5.7)
65
+ nokogiri (1.11.6)
68
66
  mini_portile2 (~> 2.5.0)
69
67
  racc (~> 1.4)
70
- nokogiri (1.11.1-x86_64-linux)
68
+ nokogiri (1.11.6-x86_64-linux)
71
69
  racc (~> 1.4)
72
70
  racc (1.5.2)
73
71
  rack (2.2.3)
74
72
  rack-test (1.1.0)
75
73
  rack (>= 1.0, < 3)
76
- rails (5.2.4.4)
77
- actioncable (= 5.2.4.4)
78
- actionmailer (= 5.2.4.4)
79
- actionpack (= 5.2.4.4)
80
- actionview (= 5.2.4.4)
81
- activejob (= 5.2.4.4)
82
- activemodel (= 5.2.4.4)
83
- activerecord (= 5.2.4.4)
84
- activestorage (= 5.2.4.4)
85
- activesupport (= 5.2.4.4)
74
+ rails (5.2.6)
75
+ actioncable (= 5.2.6)
76
+ actionmailer (= 5.2.6)
77
+ actionpack (= 5.2.6)
78
+ actionview (= 5.2.6)
79
+ activejob (= 5.2.6)
80
+ activemodel (= 5.2.6)
81
+ activerecord (= 5.2.6)
82
+ activestorage (= 5.2.6)
83
+ activesupport (= 5.2.6)
86
84
  bundler (>= 1.3.0)
87
- railties (= 5.2.4.4)
85
+ railties (= 5.2.6)
88
86
  sprockets-rails (>= 2.0.0)
89
87
  rails-dom-testing (2.0.3)
90
88
  activesupport (>= 4.2.0)
91
89
  nokogiri (>= 1.6)
92
90
  rails-html-sanitizer (1.0.4)
93
91
  loofah (~> 2.2, >= 2.2.2)
94
- railties (5.2.4.4)
95
- actionpack (= 5.2.4.4)
96
- activesupport (= 5.2.4.4)
92
+ railties (5.2.6)
93
+ actionpack (= 5.2.6)
94
+ activesupport (= 5.2.6)
97
95
  method_source
98
96
  rake (>= 0.8.7)
99
97
  thor (>= 0.19.0, < 2.0)
100
- rake (13.0.1)
98
+ rake (13.0.3)
101
99
  sprockets (4.0.2)
102
100
  concurrent-ruby (~> 1.0)
103
101
  rack (> 1, < 3)
@@ -105,11 +103,11 @@ GEM
105
103
  actionpack (>= 4.0)
106
104
  activesupport (>= 4.0)
107
105
  sprockets (>= 3.0.0)
108
- thor (1.0.1)
106
+ thor (1.1.0)
109
107
  thread_safe (0.3.6)
110
- tzinfo (1.2.8)
108
+ tzinfo (1.2.9)
111
109
  thread_safe (~> 0.1)
112
- websocket-driver (0.7.3)
110
+ websocket-driver (0.7.4)
113
111
  websocket-extensions (>= 0.1.0)
114
112
  websocket-extensions (0.1.5)
115
113