bundler-audit 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug-report.md +2 -0
- data/.github/workflows/ruby.yml +4 -5
- data/.rubocop.yml +1 -0
- data/ChangeLog.md +18 -0
- data/README.md +20 -10
- data/bundler-audit.gemspec +0 -1
- data/gemspec.yml +1 -1
- data/lib/bundler/audit/advisory.rb +1 -1
- data/lib/bundler/audit/cli/formats/json.rb +1 -1
- data/lib/bundler/audit/cli/formats/junit.rb +2 -2
- data/lib/bundler/audit/cli/formats/text.rb +2 -2
- data/lib/bundler/audit/cli/formats.rb +1 -1
- data/lib/bundler/audit/cli.rb +18 -14
- data/lib/bundler/audit/configuration.rb +1 -1
- data/lib/bundler/audit/database.rb +9 -6
- data/lib/bundler/audit/results/insecure_source.rb +1 -1
- data/lib/bundler/audit/results/unpatched_gem.rb +1 -1
- data/lib/bundler/audit/results.rb +1 -1
- data/lib/bundler/audit/scanner.rb +1 -1
- data/lib/bundler/audit/task.rb +67 -27
- data/lib/bundler/audit/version.rb +2 -2
- data/lib/bundler/audit.rb +1 -1
- data/spec/bundle/insecure_sources/Gemfile.lock +7 -7
- data/spec/bundle/secure/Gemfile +1 -1
- data/spec/bundle/secure/Gemfile.lock +12 -12
- data/spec/bundle/unpatched_gems_with_dot_configuration/Gemfile.lock +1 -1
- data/spec/cli/formats/junit_spec.rb +2 -2
- data/spec/cli/formats/text_spec.rb +2 -2
- data/spec/cli_spec.rb +16 -30
- data/spec/scanner_spec.rb +2 -2
- data/spec/task_spec.rb +141 -0
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91fab22bb836ac9e1b56f525051f80003c4c0515a8d01e779b9ba71f079ba05d
|
4
|
+
data.tar.gz: f312f73a62453f2002d58465002ab7bb8396f53ba5d51ca363e84b422f0216a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2067a4b037050d7f928e805335ea6cf053a83978888477af56d3e44199409bbf9923f46dec0963bf40906c6e8afeec39aba32722daecdfe8576410d1431733a7
|
7
|
+
data.tar.gz: 88c4b7e6c8a5d390743706dafb90ce3431df698bca07348185f0ebf0d28c3842b922d52936e743911bd56d9c4db373cdf19e309f955a44e0d1c7d7b388c7eb31
|
data/.github/workflows/ruby.yml
CHANGED
@@ -9,13 +9,12 @@ jobs:
|
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
11
|
ruby:
|
12
|
-
- 2.5
|
13
|
-
- 2.6
|
14
|
-
- 2.7
|
15
12
|
- '3.0'
|
16
|
-
- 3.1
|
13
|
+
- '3.1'
|
14
|
+
- '3.2'
|
15
|
+
- '3.3'
|
17
16
|
- jruby
|
18
|
-
- truffleruby
|
17
|
+
- truffleruby
|
19
18
|
name: Ruby ${{ matrix.ruby }}
|
20
19
|
steps:
|
21
20
|
- uses: actions/checkout@v2
|
data/.rubocop.yml
CHANGED
@@ -84,3 +84,4 @@ Style/ExpandPathArguments: { Enabled: false } # Offense count: 5
|
|
84
84
|
Style/FrozenStringLiteralComment: { Enabled: false } # Offense count: 42
|
85
85
|
Style/MixinUsage: { Exclude: ['spec/spec_helper.rb'] } # Offense count: 1
|
86
86
|
Layout/LineLength: { Enabled: false }
|
87
|
+
Style/RedundantParentheses: { Enabled: false }
|
data/ChangeLog.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
|
+
### 0.9.2 / 2024-08-22
|
2
|
+
|
3
|
+
* Officially support Ruby 3.2 and 3.3.
|
4
|
+
* Corrected the gemspec license to indicate GPL-3.0 *or* later.
|
5
|
+
|
6
|
+
#### CLI
|
7
|
+
|
8
|
+
* Correctly handle {Bundler::Audit::Database::UpdateFailed} exceptions in
|
9
|
+
`bundle-audit update`.
|
10
|
+
* Changed wording from "upgrade to" to "update to" in `bundle-audit check`
|
11
|
+
output.
|
12
|
+
|
13
|
+
#### Rake Task
|
14
|
+
|
15
|
+
* Fixed empty `bundle:audit:update` rake task.
|
16
|
+
|
1
17
|
### 0.9.1 / 2022-05-19
|
2
18
|
|
19
|
+
* Opt into rubygems.org MFA requirement.
|
20
|
+
|
3
21
|
#### CLI
|
4
22
|
|
5
23
|
* Improve the readability of the suggested gem versions to upgrade to
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Audit a project's `Gemfile.lock`:
|
|
31
31
|
Criticality: Medium
|
32
32
|
URL: http://www.osvdb.org/show/osvdb/91452
|
33
33
|
Title: XSS vulnerability in sanitize_css in Action Pack
|
34
|
-
Solution:
|
34
|
+
Solution: update to ~> 2.3.18, ~> 3.1.12, >= 3.2.13
|
35
35
|
|
36
36
|
Name: actionpack
|
37
37
|
Version: 3.2.10
|
@@ -39,7 +39,7 @@ Audit a project's `Gemfile.lock`:
|
|
39
39
|
Criticality: Medium
|
40
40
|
URL: http://osvdb.org/show/osvdb/91454
|
41
41
|
Title: XSS Vulnerability in the `sanitize` helper of Ruby on Rails
|
42
|
-
Solution:
|
42
|
+
Solution: update to ~> 2.3.18, ~> 3.1.12, >= 3.2.13
|
43
43
|
|
44
44
|
Name: actionpack
|
45
45
|
Version: 3.2.10
|
@@ -47,7 +47,7 @@ Audit a project's `Gemfile.lock`:
|
|
47
47
|
Criticality: High
|
48
48
|
URL: http://osvdb.org/show/osvdb/89026
|
49
49
|
Title: Ruby on Rails params_parser.rb Action Pack Type Casting Parameter Parsing Remote Code Execution
|
50
|
-
Solution:
|
50
|
+
Solution: update to ~> 2.3.15, ~> 3.0.19, ~> 3.1.10, >= 3.2.11
|
51
51
|
|
52
52
|
Name: activerecord
|
53
53
|
Version: 3.2.10
|
@@ -55,7 +55,7 @@ Audit a project's `Gemfile.lock`:
|
|
55
55
|
Criticality: High
|
56
56
|
URL: http://osvdb.org/show/osvdb/91453
|
57
57
|
Title: Symbol DoS vulnerability in Active Record
|
58
|
-
Solution:
|
58
|
+
Solution: update to ~> 2.3.18, ~> 3.1.12, >= 3.2.13
|
59
59
|
|
60
60
|
Name: activerecord
|
61
61
|
Version: 3.2.10
|
@@ -63,7 +63,7 @@ Audit a project's `Gemfile.lock`:
|
|
63
63
|
Criticality: Medium
|
64
64
|
URL: http://direct.osvdb.org/show/osvdb/90072
|
65
65
|
Title: Ruby on Rails Active Record attr_protected Method Bypass
|
66
|
-
Solution:
|
66
|
+
Solution: update to ~> 2.3.17, ~> 3.1.11, >= 3.2.12
|
67
67
|
|
68
68
|
Name: activerecord
|
69
69
|
Version: 3.2.10
|
@@ -71,7 +71,7 @@ Audit a project's `Gemfile.lock`:
|
|
71
71
|
Criticality: High
|
72
72
|
URL: http://osvdb.org/show/osvdb/89025
|
73
73
|
Title: Ruby on Rails Active Record JSON Parameter Parsing Query Bypass
|
74
|
-
Solution:
|
74
|
+
Solution: update to ~> 2.3.16, ~> 3.0.19, ~> 3.1.10, >= 3.2.11
|
75
75
|
|
76
76
|
Name: activesupport
|
77
77
|
Version: 3.2.10
|
@@ -79,7 +79,7 @@ Audit a project's `Gemfile.lock`:
|
|
79
79
|
Criticality: High
|
80
80
|
URL: http://www.osvdb.org/show/osvdb/91451
|
81
81
|
Title: XML Parsing Vulnerability affecting JRuby users
|
82
|
-
Solution:
|
82
|
+
Solution: update to ~> 3.1.12, >= 3.2.13
|
83
83
|
|
84
84
|
Unpatched versions found!
|
85
85
|
|
@@ -147,10 +147,20 @@ $ bundle-audit check --format json --output bundle-audit.json
|
|
147
147
|
|
148
148
|
## Rake Tasks
|
149
149
|
|
150
|
-
Bundler-audit provides
|
151
|
-
its vulnerability database
|
150
|
+
Bundler-audit provides `rake` tasks for checking the code and for updating
|
151
|
+
its vulnerability database.
|
152
|
+
|
153
|
+
Simply add the following code to the `Rakefile`:
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
require 'bundler/audit/task'
|
157
|
+
Bundler::Audit::Task.new
|
158
|
+
```
|
159
|
+
|
160
|
+
The following `rake` tasks will then become available:
|
152
161
|
|
153
162
|
```bash
|
163
|
+
$ rake -T
|
154
164
|
rake bundle:audit
|
155
165
|
rake bundle:audit:update
|
156
166
|
```
|
@@ -231,7 +241,7 @@ $ brew install git
|
|
231
241
|
|
232
242
|
## License
|
233
243
|
|
234
|
-
Copyright (c) 2013-
|
244
|
+
Copyright (c) 2013-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
|
235
245
|
|
236
246
|
bundler-audit is free software: you can redistribute it and/or modify
|
237
247
|
it under the terms of the GNU General Public License as published by
|
data/bundler-audit.gemspec
CHANGED
@@ -30,7 +30,6 @@ Gem::Specification.new do |gem|
|
|
30
30
|
gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
|
31
31
|
|
32
32
|
gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
|
33
|
-
gem.test_files = glob[gemspec['test_files'] || 'spec/{**/}*_spec.rb']
|
34
33
|
gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
|
35
34
|
|
36
35
|
gem.require_paths = Array(gemspec.fetch('require_paths') {
|
data/gemspec.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
name: bundler-audit
|
2
2
|
summary: Patch-level verification for Bundler
|
3
3
|
description: bundler-audit provides patch-level verification for Bundled apps.
|
4
|
-
license: GPL-3.0
|
4
|
+
license: GPL-3.0-or-later
|
5
5
|
authors: Postmodern
|
6
6
|
email: postmodern.mod3@gmail.com
|
7
7
|
homepage: https://github.com/rubysec/bundler-audit#readme
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -101,7 +101,7 @@ module Bundler
|
|
101
101
|
|
102
102
|
def advisory_solution(advisory)
|
103
103
|
unless advisory.patched_versions.empty?
|
104
|
-
"
|
104
|
+
"update to #{advisory.patched_versions.map { |v| "'#{v}'" }.join(', ')}"
|
105
105
|
else
|
106
106
|
"remove or disable this gem until a patch is available!"
|
107
107
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -104,7 +104,7 @@ module Bundler
|
|
104
104
|
end
|
105
105
|
|
106
106
|
unless advisory.patched_versions.empty?
|
107
|
-
say "Solution:
|
107
|
+
say "Solution: update to ", :red
|
108
108
|
say advisory.patched_versions.map { |v| "'#{v}'" }.join(', ')
|
109
109
|
else
|
110
110
|
say "Solution: ", :red
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
data/lib/bundler/audit/cli.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -67,7 +67,7 @@ module Bundler
|
|
67
67
|
|
68
68
|
database = Database.new(options[:database])
|
69
69
|
scanner = begin
|
70
|
-
Scanner.new(dir,options[:gemfile_lock],database,
|
70
|
+
Scanner.new(dir,options[:gemfile_lock],database,options[:config])
|
71
71
|
rescue Bundler::GemfileLockNotFound => exception
|
72
72
|
say exception.message, :red
|
73
73
|
exit 1
|
@@ -137,19 +137,23 @@ module Bundler
|
|
137
137
|
|
138
138
|
database = Database.new(path)
|
139
139
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
140
|
+
begin
|
141
|
+
case database.update!(quiet: options.quiet?)
|
142
|
+
when true
|
143
|
+
say("Updated ruby-advisory-db", :green) unless options.quiet?
|
144
|
+
when nil
|
145
|
+
if Bundler.git_present?
|
146
|
+
unless options.quiet?
|
147
|
+
say "Skipping update, ruby-advisory-db is not a git repository", :yellow
|
148
|
+
end
|
149
|
+
else
|
150
|
+
say_error "Git is not installed!", :red
|
151
|
+
exit 1
|
152
|
+
end
|
150
153
|
end
|
151
|
-
|
152
|
-
say
|
154
|
+
rescue Database::UpdateFailed => error
|
155
|
+
say error.message, :red
|
156
|
+
exit 1
|
153
157
|
end
|
154
158
|
|
155
159
|
stats(path) unless options.quiet?
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -141,9 +141,8 @@ module Bundler
|
|
141
141
|
# @option options [Boolean] :quiet
|
142
142
|
# Specify whether `git` should be `--quiet`.
|
143
143
|
#
|
144
|
-
# @return [Boolean
|
144
|
+
# @return [Boolean]
|
145
145
|
# Specifies whether the update was successful.
|
146
|
-
# A `nil` indicates no update was performed.
|
147
146
|
#
|
148
147
|
# @raise [ArgumentError]
|
149
148
|
# Invalid options were given.
|
@@ -192,9 +191,13 @@ module Bundler
|
|
192
191
|
# Specify whether `git` should be `--quiet`.
|
193
192
|
#
|
194
193
|
# @return [true, nil]
|
195
|
-
# `true`
|
196
|
-
#
|
197
|
-
#
|
194
|
+
# * `true` - the ruby-advisory-db git repository was successfully
|
195
|
+
# updated.
|
196
|
+
# * `nil` - the ruby-advisory-db is not a git repository or the `git`
|
197
|
+
# command is not installed.
|
198
|
+
#
|
199
|
+
# @raise [UpdateFailed]
|
200
|
+
# Could not update the ruby-advisory-db git repository.
|
198
201
|
#
|
199
202
|
# @since 0.8.0
|
200
203
|
#
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
data/lib/bundler/audit/task.rb
CHANGED
@@ -16,33 +16,6 @@ module Bundler
|
|
16
16
|
define
|
17
17
|
end
|
18
18
|
|
19
|
-
protected
|
20
|
-
|
21
|
-
#
|
22
|
-
# Defines the `bundle:audit` and `bundle:audit:update` task.
|
23
|
-
#
|
24
|
-
def define
|
25
|
-
namespace :bundle do
|
26
|
-
namespace :audit do
|
27
|
-
desc 'Checks the Gemfile.lock for insecure dependencies'
|
28
|
-
task :check do
|
29
|
-
bundler_audit 'check'
|
30
|
-
end
|
31
|
-
|
32
|
-
desc 'Updates the bundler-audit vulnerability database'
|
33
|
-
task :update do
|
34
|
-
bundler_audit 'update'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
task :audit => 'audit:check'
|
39
|
-
end
|
40
|
-
|
41
|
-
task 'bundler:audit' => 'bundle:audit'
|
42
|
-
task 'bundler:audit:check' => 'bundle:audit:check'
|
43
|
-
task 'bundler:audit:update' => 'bundle:audit:update'
|
44
|
-
end
|
45
|
-
|
46
19
|
#
|
47
20
|
# Runs the `bundler-audit` command with the additional arguments.
|
48
21
|
#
|
@@ -59,6 +32,8 @@ module Bundler
|
|
59
32
|
# If the `bundler-audit` command exits with an error, the rake task
|
60
33
|
# will also exit with the same error code.
|
61
34
|
#
|
35
|
+
# @api private
|
36
|
+
#
|
62
37
|
def bundler_audit(*arguments)
|
63
38
|
case system('bundler-audit',*arguments)
|
64
39
|
when false
|
@@ -69,6 +44,71 @@ module Bundler
|
|
69
44
|
return true
|
70
45
|
end
|
71
46
|
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Runs the `bundle-audit check` command.
|
50
|
+
#
|
51
|
+
# @return [true]
|
52
|
+
# The `bundler-audit` command successfully exited.
|
53
|
+
#
|
54
|
+
# @raise [CommandNotFound]
|
55
|
+
# The `bundler-audit` command could not be executed or was not found.
|
56
|
+
#
|
57
|
+
# @note
|
58
|
+
# If the `bundler-audit` command exits with an error, the rake task
|
59
|
+
# will also exit with the same error code.
|
60
|
+
#
|
61
|
+
# @api private
|
62
|
+
#
|
63
|
+
def check
|
64
|
+
bundler_audit 'check'
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# Runs the `bundle-audit update` command.
|
69
|
+
#
|
70
|
+
# @return [true]
|
71
|
+
# The `bundler-audit` command successfully exited.
|
72
|
+
#
|
73
|
+
# @raise [CommandNotFound]
|
74
|
+
# The `bundler-audit` command could not be executed or was not found.
|
75
|
+
#
|
76
|
+
# @note
|
77
|
+
# If the `bundler-audit` command exits with an error, the rake task
|
78
|
+
# will also exit with the same error code.
|
79
|
+
#
|
80
|
+
# @api private
|
81
|
+
#
|
82
|
+
def update
|
83
|
+
bundler_audit 'update'
|
84
|
+
end
|
85
|
+
|
86
|
+
protected
|
87
|
+
|
88
|
+
#
|
89
|
+
# Defines the `bundle:audit` and `bundle:audit:update` task.
|
90
|
+
#
|
91
|
+
def define
|
92
|
+
namespace :bundle do
|
93
|
+
namespace :audit do
|
94
|
+
desc 'Checks the Gemfile.lock for insecure dependencies'
|
95
|
+
task :check do
|
96
|
+
check
|
97
|
+
end
|
98
|
+
|
99
|
+
desc 'Updates the bundler-audit vulnerability database'
|
100
|
+
task :update do
|
101
|
+
update
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
task :audit => 'audit:check'
|
106
|
+
end
|
107
|
+
|
108
|
+
task 'bundler:audit' => 'bundle:audit'
|
109
|
+
task 'bundler:audit:check' => 'bundle:audit:check'
|
110
|
+
task 'bundler:audit:update' => 'bundle:audit:update'
|
111
|
+
end
|
72
112
|
end
|
73
113
|
end
|
74
114
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -18,6 +18,6 @@
|
|
18
18
|
module Bundler
|
19
19
|
module Audit
|
20
20
|
# bundler-audit version
|
21
|
-
VERSION = '0.9.
|
21
|
+
VERSION = '0.9.2'
|
22
22
|
end
|
23
23
|
end
|
data/lib/bundler/audit.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2013-
|
2
|
+
# Copyright (c) 2013-2024 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
|
@@ -77,7 +77,7 @@ GEM
|
|
77
77
|
activesupport (>= 4.2.0)
|
78
78
|
i18n (1.8.10)
|
79
79
|
concurrent-ruby (~> 1.0)
|
80
|
-
loofah (2.
|
80
|
+
loofah (2.19.1)
|
81
81
|
crass (~> 1.0.2)
|
82
82
|
nokogiri (>= 1.5.9)
|
83
83
|
mail (2.7.1)
|
@@ -88,13 +88,13 @@ GEM
|
|
88
88
|
mini_portile2 (2.8.0)
|
89
89
|
minitest (5.14.4)
|
90
90
|
nio4r (2.5.7)
|
91
|
-
nokogiri (1.13.
|
91
|
+
nokogiri (1.13.10)
|
92
92
|
mini_portile2 (~> 2.8.0)
|
93
93
|
racc (~> 1.4)
|
94
|
-
nokogiri (1.13.
|
94
|
+
nokogiri (1.13.10-x86_64-linux)
|
95
95
|
racc (~> 1.4)
|
96
|
-
racc (1.6.
|
97
|
-
rack (2.2.3)
|
96
|
+
racc (1.6.1)
|
97
|
+
rack (2.2.6.3)
|
98
98
|
rack-test (1.1.0)
|
99
99
|
rack (>= 1.0, < 3)
|
100
100
|
rails (6.1.3.2)
|
@@ -115,8 +115,8 @@ GEM
|
|
115
115
|
rails-dom-testing (2.0.3)
|
116
116
|
activesupport (>= 4.2.0)
|
117
117
|
nokogiri (>= 1.6)
|
118
|
-
rails-html-sanitizer (1.
|
119
|
-
loofah (~> 2.
|
118
|
+
rails-html-sanitizer (1.4.4)
|
119
|
+
loofah (~> 2.19, >= 2.19.1)
|
120
120
|
railties (6.1.3.2)
|
121
121
|
actionpack (= 6.1.3.2)
|
122
122
|
activesupport (= 6.1.3.2)
|
data/spec/bundle/secure/Gemfile
CHANGED
@@ -47,11 +47,11 @@ GEM
|
|
47
47
|
concurrent-ruby (1.1.10)
|
48
48
|
crass (1.0.6)
|
49
49
|
erubi (1.10.0)
|
50
|
-
globalid (1.0.
|
50
|
+
globalid (1.0.1)
|
51
51
|
activesupport (>= 5.0)
|
52
|
-
i18n (1.
|
52
|
+
i18n (1.12.0)
|
53
53
|
concurrent-ruby (~> 1.0)
|
54
|
-
loofah (2.
|
54
|
+
loofah (2.19.1)
|
55
55
|
crass (~> 1.0.2)
|
56
56
|
nokogiri (>= 1.5.9)
|
57
57
|
mail (2.7.1)
|
@@ -60,15 +60,15 @@ GEM
|
|
60
60
|
method_source (1.0.0)
|
61
61
|
mini_mime (1.1.2)
|
62
62
|
mini_portile2 (2.8.0)
|
63
|
-
minitest (5.
|
63
|
+
minitest (5.17.0)
|
64
64
|
nio4r (2.5.8)
|
65
|
-
nokogiri (1.13.
|
65
|
+
nokogiri (1.13.10)
|
66
66
|
mini_portile2 (~> 2.8.0)
|
67
67
|
racc (~> 1.4)
|
68
|
-
nokogiri (1.13.
|
68
|
+
nokogiri (1.13.10-x86_64-linux)
|
69
69
|
racc (~> 1.4)
|
70
|
-
racc (1.6.
|
71
|
-
rack (2.2.3)
|
70
|
+
racc (1.6.1)
|
71
|
+
rack (2.2.6.3)
|
72
72
|
rack-test (1.1.0)
|
73
73
|
rack (>= 1.0, < 3)
|
74
74
|
rails (5.2.8)
|
@@ -87,8 +87,8 @@ GEM
|
|
87
87
|
rails-dom-testing (2.0.3)
|
88
88
|
activesupport (>= 4.2.0)
|
89
89
|
nokogiri (>= 1.6)
|
90
|
-
rails-html-sanitizer (1.
|
91
|
-
loofah (~> 2.
|
90
|
+
rails-html-sanitizer (1.4.4)
|
91
|
+
loofah (~> 2.19, >= 2.19.1)
|
92
92
|
railties (5.2.8)
|
93
93
|
actionpack (= 5.2.8)
|
94
94
|
activesupport (= 5.2.8)
|
@@ -105,7 +105,7 @@ GEM
|
|
105
105
|
sprockets (>= 3.0.0)
|
106
106
|
thor (1.2.1)
|
107
107
|
thread_safe (0.3.6)
|
108
|
-
tzinfo (1.2.
|
108
|
+
tzinfo (1.2.10)
|
109
109
|
thread_safe (~> 0.1)
|
110
110
|
websocket-driver (0.7.5)
|
111
111
|
websocket-extensions (>= 0.1.0)
|
@@ -117,7 +117,7 @@ PLATFORMS
|
|
117
117
|
|
118
118
|
DEPENDENCIES
|
119
119
|
rails (~> 5.2)
|
120
|
-
rails-html-sanitizer (~> 1.
|
120
|
+
rails-html-sanitizer (~> 1.4.4)
|
121
121
|
|
122
122
|
BUNDLED WITH
|
123
123
|
2.3.6
|
@@ -240,8 +240,8 @@ describe Bundler::Audit::CLI::Formats::Junit do
|
|
240
240
|
end
|
241
241
|
|
242
242
|
context "when Advisory#patched_versions is not empty" do
|
243
|
-
it 'must print "Solution:
|
244
|
-
expect(output).to include("Solution:
|
243
|
+
it 'must print "Solution: update to ..."' do
|
244
|
+
expect(output).to include("Solution: update to #{CGI.escapeHTML(advisory.patched_versions.map { |v| "'#{v}'" }.join(', '))}")
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
@@ -229,8 +229,8 @@ describe Bundler::Audit::CLI::Formats::Text do
|
|
229
229
|
end
|
230
230
|
|
231
231
|
context "when Advisory#patched_versions is not empty" do
|
232
|
-
it 'must print "Solution:
|
233
|
-
expect(output_lines).to include("Solution:
|
232
|
+
it 'must print "Solution: update to ..."' do
|
233
|
+
expect(output_lines).to include("Solution: update to #{advisory.patched_versions.map { |v| "'#{v}'" }.join(', ')}")
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
data/spec/cli_spec.rb
CHANGED
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
require 'bundler/audit/cli'
|
3
3
|
|
4
4
|
describe Bundler::Audit::CLI do
|
5
|
+
let(:database_path) { "/path/to/ruby-advisory-db" }
|
6
|
+
|
5
7
|
describe ".start" do
|
6
8
|
context "with wrong arguments" do
|
7
9
|
it "exits with error status code" do
|
@@ -76,23 +78,17 @@ describe Bundler::Audit::CLI do
|
|
76
78
|
|
77
79
|
context "when update fails" do
|
78
80
|
before do
|
79
|
-
expect(database).to receive(:update!).
|
81
|
+
expect(database).to receive(:update!).with(quiet: false).and_raise(
|
82
|
+
Bundler::Audit::Database::UpdateFailed,
|
83
|
+
"failed to update #{database_path.inspect}"
|
84
|
+
)
|
80
85
|
end
|
81
86
|
|
82
|
-
it "
|
87
|
+
it "must print an error message and exit with 1" do
|
83
88
|
expect {
|
84
|
-
|
89
|
+
expect {
|
85
90
|
subject.update
|
86
|
-
|
87
|
-
end
|
88
|
-
}.to output(/Failed updating ruby-advisory-db!/).to_stderr
|
89
|
-
end
|
90
|
-
|
91
|
-
it "exits with error status code" do
|
92
|
-
expect {
|
93
|
-
# Capture output of `update` only to keep spec output clean.
|
94
|
-
# The test regarding specific output is above.
|
95
|
-
expect { subject.update }.to output.to_stdout
|
91
|
+
}.to output("failed to update #{database_path.inspect}").to_stderr
|
96
92
|
}.to raise_error(SystemExit) do |error|
|
97
93
|
expect(error.success?).to eq(false)
|
98
94
|
expect(error.status).to eq(1)
|
@@ -136,9 +132,7 @@ describe Bundler::Audit::CLI do
|
|
136
132
|
|
137
133
|
context "when update succeeds" do
|
138
134
|
before do
|
139
|
-
expect(database).to(
|
140
|
-
receive(:update!).with(quiet: true).and_return(true)
|
141
|
-
)
|
135
|
+
expect(database).to receive(:update!).with(quiet: true).and_return(true)
|
142
136
|
end
|
143
137
|
|
144
138
|
it "does not print any output" do
|
@@ -148,25 +142,17 @@ describe Bundler::Audit::CLI do
|
|
148
142
|
|
149
143
|
context "when update fails" do
|
150
144
|
before do
|
151
|
-
expect(database).to(
|
152
|
-
|
145
|
+
expect(database).to receive(:update!).with(quiet: true).and_raise(
|
146
|
+
Bundler::Audit::Database::UpdateFailed,
|
147
|
+
"failed to update #{database_path.inspect}"
|
153
148
|
)
|
154
149
|
end
|
155
150
|
|
156
|
-
it "
|
151
|
+
it "must print the error message and exit with an error code" do
|
157
152
|
expect {
|
158
|
-
|
153
|
+
expect {
|
159
154
|
subject.update
|
160
|
-
|
161
|
-
end
|
162
|
-
}.to_not output.to_stderr
|
163
|
-
end
|
164
|
-
|
165
|
-
it "exits with error status code" do
|
166
|
-
expect {
|
167
|
-
# Capture output of `update` only to keep spec output clean.
|
168
|
-
# The test regarding specific output is above.
|
169
|
-
expect { subject.update }.to output.to_stdout
|
155
|
+
}.to output("failed to update: #{database_path.inspect}").to_stderr
|
170
156
|
}.to raise_error(SystemExit) do |error|
|
171
157
|
expect(error.success?).to eq(false)
|
172
158
|
expect(error.status).to eq(1)
|
data/spec/scanner_spec.rb
CHANGED
@@ -36,12 +36,12 @@ describe Scanner do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context "when the :ignore option is given" do
|
39
|
-
subject { super().scan(ignore: ['
|
39
|
+
subject { super().scan(ignore: ['CVE-2013-0156']) }
|
40
40
|
|
41
41
|
it "should ignore the specified advisories" do
|
42
42
|
ids = subject.map { |result| result.advisory.id }
|
43
43
|
|
44
|
-
expect(ids).not_to include('
|
44
|
+
expect(ids).not_to include('CVE-2013-0156')
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
data/spec/task_spec.rb
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'bundler/audit/task'
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
describe Bundler::Audit::Task do
|
7
|
+
before { subject }
|
8
|
+
|
9
|
+
it "must define a 'bundle:audit:check' task" do
|
10
|
+
expect(Rake::Task['bundle:audit:check']).to_not be_nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it "must define a 'bundle:audit:update' task" do
|
14
|
+
expect(Rake::Task['bundle:audit:update']).to_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "must define a 'bundle:audit' task" do
|
18
|
+
expect(Rake::Task['bundle:audit']).to_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "must define a 'bundler:audit:check' task" do
|
22
|
+
expect(Rake::Task['bundler:audit:check']).to_not be_nil
|
23
|
+
end
|
24
|
+
|
25
|
+
it "must define a 'bundler:audit:update' task" do
|
26
|
+
expect(Rake::Task['bundler:audit:update']).to_not be_nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it "must define a 'bundler:audit' task" do
|
30
|
+
expect(Rake::Task['bundler:audit']).to_not be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#bundler_audit" do
|
34
|
+
let(:subcommand) { 'subcommand' }
|
35
|
+
context "when the command exits successfully" do
|
36
|
+
before do
|
37
|
+
allow(subject).to receive(:system).with('bundler-audit',subcommand).and_return(true)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "must return true" do
|
41
|
+
expect(subject.bundler_audit(subcommand)).to be(true)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "when there vulnerabilities are found" do
|
46
|
+
before do
|
47
|
+
allow(subject).to receive(:system).with('bundler-audit',subcommand).and_return(false)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "must exit with a non-zero error code" do
|
51
|
+
expect(subject).to receive(:exit).with($?.exitstatus)
|
52
|
+
|
53
|
+
subject.bundler_audit(subcommand)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "when the bundler-audit command cannot be executed" do
|
58
|
+
before do
|
59
|
+
allow(subject).to receive(:system).with('bundler-audit',subcommand).and_return(nil)
|
60
|
+
end
|
61
|
+
|
62
|
+
it do
|
63
|
+
expect {
|
64
|
+
subject.bundler_audit(subcommand)
|
65
|
+
}.to raise_error(described_class::CommandNotFound,"bundler-audit could not be executed")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "#check" do
|
71
|
+
context "when the command exits successfully" do
|
72
|
+
before do
|
73
|
+
allow(subject).to receive(:system).with('bundler-audit','check').and_return(true)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "must return true" do
|
77
|
+
expect(subject.check).to be(true)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context "when there vulnerabilities are found" do
|
82
|
+
before do
|
83
|
+
allow(subject).to receive(:system).with('bundler-audit','check').and_return(false)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "must exit with a non-zero error code" do
|
87
|
+
expect(subject).to receive(:exit).with($?.exitstatus)
|
88
|
+
|
89
|
+
subject.check
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context "when the bundler-audit command cannot be executed" do
|
94
|
+
before do
|
95
|
+
allow(subject).to receive(:system).with('bundler-audit','check').and_return(nil)
|
96
|
+
end
|
97
|
+
|
98
|
+
it do
|
99
|
+
expect {
|
100
|
+
subject.check
|
101
|
+
}.to raise_error(described_class::CommandNotFound,"bundler-audit could not be executed")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "#update" do
|
107
|
+
context "when the command exits successfully" do
|
108
|
+
before do
|
109
|
+
allow(subject).to receive(:system).with('bundler-audit','update').and_return(true)
|
110
|
+
end
|
111
|
+
|
112
|
+
it "must return true" do
|
113
|
+
expect(subject.update).to be(true)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context "when there vulnerabilities are found" do
|
118
|
+
before do
|
119
|
+
allow(subject).to receive(:system).with('bundler-audit','update').and_return(false)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "must exit with a non-zero error code" do
|
123
|
+
expect(subject).to receive(:exit).with($?.exitstatus)
|
124
|
+
|
125
|
+
subject.update
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context "when the bundler-audit command cannot be executed" do
|
130
|
+
before do
|
131
|
+
allow(subject).to receive(:system).with('bundler-audit','update').and_return(nil)
|
132
|
+
end
|
133
|
+
|
134
|
+
it do
|
135
|
+
expect {
|
136
|
+
subject.update
|
137
|
+
}.to raise_error(described_class::CommandNotFound,"bundler-audit could not be executed")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler-audit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -124,9 +124,10 @@ files:
|
|
124
124
|
- spec/results/unpatched_gem_spec.rb
|
125
125
|
- spec/scanner_spec.rb
|
126
126
|
- spec/spec_helper.rb
|
127
|
+
- spec/task_spec.rb
|
127
128
|
homepage: https://github.com/rubysec/bundler-audit#readme
|
128
129
|
licenses:
|
129
|
-
- GPL-3.0
|
130
|
+
- GPL-3.0-or-later
|
130
131
|
metadata:
|
131
132
|
rubygems_mfa_required: 'true'
|
132
133
|
post_install_message:
|
@@ -144,23 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
145
|
- !ruby/object:Gem::Version
|
145
146
|
version: 1.8.0
|
146
147
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
148
|
+
rubygems_version: 3.5.11
|
148
149
|
signing_key:
|
149
150
|
specification_version: 4
|
150
151
|
summary: Patch-level verification for Bundler
|
151
|
-
test_files:
|
152
|
-
- spec/advisory_spec.rb
|
153
|
-
- spec/audit_spec.rb
|
154
|
-
- spec/cli/formats/json_spec.rb
|
155
|
-
- spec/cli/formats/junit_spec.rb
|
156
|
-
- spec/cli/formats/text_spec.rb
|
157
|
-
- spec/cli/formats_spec.rb
|
158
|
-
- spec/cli_spec.rb
|
159
|
-
- spec/configuration_spec.rb
|
160
|
-
- spec/database_spec.rb
|
161
|
-
- spec/integration_spec.rb
|
162
|
-
- spec/report_spec.rb
|
163
|
-
- spec/results/insecure_source_spec.rb
|
164
|
-
- spec/results/result_spec.rb
|
165
|
-
- spec/results/unpatched_gem_spec.rb
|
166
|
-
- spec/scanner_spec.rb
|
152
|
+
test_files: []
|