Skip to content

Commit 3a83394

Browse files
authored
Merge pull request #37 from mikesaelim/maintenance
Maintenance
2 parents e326763 + f891038 commit 3a83394

10 files changed

+38
-27
lines changed

.github/workflows/test.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
test:
1313
strategy:
1414
matrix:
15-
ruby_version: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3]
15+
ruby_version: [3.1, 3.2, 3.3]
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v2
@@ -21,8 +21,6 @@ jobs:
2121
with:
2222
ruby-version: ${{ matrix.ruby_version }}
2323
bundler-cache: true
24-
- name: Install dependencies
25-
run: bundle install --jobs=3 --retry=3
2624
- name: Initialize submodule
2725
run: git submodule update --init
2826
- name: Run tests

.rubocop.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
AllCops:
2-
TargetRubyVersion: 2.5
2+
TargetRubyVersion: 3.1
33
NewCops: enable
44
SuggestExtensions: false
55

6+
Gemspec/DevelopmentDependencies:
7+
EnforcedStyle: gemspec
8+
69
Layout/LineLength:
710
Exclude:
811
- 'ruby_audit.gemspec'
@@ -11,7 +14,7 @@ Metrics/MethodLength:
1114
Max: 15
1215

1316
Metrics/BlockLength:
14-
IgnoredMethods:
17+
AllowedMethods:
1518
- describe
1619

1720
Style/Documentation:

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.0
1+
3.3.1

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## [Unreleased]
77

8+
### Changed
9+
10+
* Bumped Rubocop dependency to 1.64.0
11+
* Require MFA for rubygems operations
12+
13+
### Removed
14+
15+
* Removed support for Ruby 2.5 through 3.0
16+
* Removed Timecop dependency
17+
818
## [2.3.1] - 2024-05-17
919

1020
### Removed
@@ -108,7 +118,8 @@ Look for rubygems advisories in the correct directory of the ruby-advisory-db
108118

109119
* Initial Release
110120

111-
[Unreleased]: https://github.com/civisanalytics/ruby_audit/compare/v2.3.0...HEAD
121+
[Unreleased]: https://github.com/civisanalytics/ruby_audit/compare/v2.3.1...HEAD
122+
[2.3.1]: https://github.com/civisanalytics/ruby_audit/compare/v2.3.0...v2.3.1
112123
[2.3.0]: https://github.com/civisanalytics/ruby_audit/compare/v2.2.0...v2.3.0
113124
[2.2.0]: https://github.com/civisanalytics/ruby_audit/compare/v2.1.0...v2.2.0
114125
[2.1.0]: https://github.com/civisanalytics/ruby_audit/compare/v2.0.0...v2.1.0

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $ ruby-audit check -n
5757

5858
After checking out the repo, run `bin/setup` to install dependencies.
5959
You'll also want to run `git submodule update --init` to populate the ruby-advisory-db
60-
submodule in `/vendor` that is used for testing. Then, run `rake spec` to run the tests.
60+
submodule in `/vendor` that is used for testing. Then, run `rake` to run linting and tests.
6161
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
6262

6363
The database in `/vendor/ruby-advisory-db` is only used as a fixture for unit tests.

lib/ruby_audit/database.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ def advisories_for(name, type)
1010
end
1111
end
1212

13-
def check_ruby(ruby, &block)
14-
check(ruby, 'rubies', &block)
13+
def check_ruby(ruby, &)
14+
check(ruby, 'rubies', &)
1515
end
1616

17-
def check_rubygems(rubygems, &block)
18-
check(rubygems, 'gems', &block)
17+
def check_rubygems(rubygems, &)
18+
check(rubygems, 'gems', &)
1919
end
2020

2121
def check(object, type = 'gems')
@@ -28,12 +28,12 @@ def check(object, type = 'gems')
2828

2929
protected
3030

31-
def each_advisory_path(&block)
32-
Dir.glob(File.join(@path, '{gems,rubies}', '*', '*.yml'), &block)
31+
def each_advisory_path(&)
32+
Dir.glob(File.join(@path, '{gems,rubies}', '*', '*.yml'), &)
3333
end
3434

35-
def each_advisory_path_for(name, type = 'gems', &block)
36-
Dir.glob(File.join(@path, type, name, '*.yml'), &block)
35+
def each_advisory_path_for(name, type = 'gems', &)
36+
Dir.glob(File.join(@path, type, name, '*.yml'), &)
3737
end
3838
end
3939
end

lib/ruby_audit/scanner.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ def scan(options = {}, &block)
2525
self
2626
end
2727

28-
def scan_ruby(options = {}, &block)
28+
def scan_ruby(options = {}, &)
2929
version = if RUBY_PATCHLEVEL < 0
3030
ruby_version
3131
else
3232
"#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"
3333
end
3434
specs = [Version.new(RUBY_ENGINE, version)]
35-
scan_inner(specs, 'ruby', options, &block)
35+
scan_inner(specs, 'ruby', options, &)
3636
end
3737

38-
def scan_rubygems(options = {}, &block)
38+
def scan_rubygems(options = {}, &)
3939
specs = [Version.new('rubygems-update', rubygems_version)]
40-
scan_inner(specs, 'rubygems', options, &block)
40+
scan_inner(specs, 'rubygems', options, &)
4141
end
4242

4343
private
@@ -61,7 +61,7 @@ def scan_inner(specs, type, options = {})
6161
ignore += options[:ignore] if options[:ignore]
6262

6363
specs.each do |spec|
64-
@database.send("check_#{type}".to_sym, spec) do |advisory|
64+
@database.send(:"check_#{type}", spec) do |advisory|
6565
unless ignore.intersect?(advisory.identifiers.to_set)
6666
yield Bundler::Audit::Results::UnpatchedGem.new(spec, advisory)
6767
end

ruby_audit.gemspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
77
spec.version = RubyAudit::VERSION
88
spec.authors = ['Jeff Cousens, Mike Saelim', 'John Zhang', 'Cristina Muñoz']
99
spec.email = ['opensource@civisanalytics.com']
10+
spec.metadata['rubygems_mfa_required'] = 'true'
1011

1112
spec.summary = 'Checks Ruby and RubyGems against known vulnerabilities.'
1213
spec.description = 'RubyAudit checks your current version of Ruby and ' \
@@ -17,7 +18,7 @@ Gem::Specification.new do |spec|
1718
spec.homepage = 'https://github.com/civisanalytics/ruby_audit'
1819
spec.license = 'GPL-3.0-or-later'
1920

20-
spec.required_ruby_version = ['>= 2.5', '< 3.4']
21+
spec.required_ruby_version = ['>= 3.1', '< 3.4']
2122
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
2223
spec.bindir = 'exe'
2324
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -27,6 +28,5 @@ Gem::Specification.new do |spec|
2728
spec.add_development_dependency 'pry', '~> 0.14.1'
2829
spec.add_development_dependency 'rake', '~> 13.0'
2930
spec.add_development_dependency 'rspec', '~> 3.9'
30-
spec.add_development_dependency 'rubocop', '~> 1.9.1'
31-
spec.add_development_dependency 'timecop', '~> 0.9.1'
31+
spec.add_development_dependency 'rubocop', '~> 1.64.0'
3232
end

spec/database_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
advisory.is_a?(Bundler::Audit::Advisory)
1818
end).to be_truthy
1919
expect(advisories.map(&:id)).to include('CVE-2015-3900')
20-
expect(advisories.map(&:path).reject { |p| p =~ /rubygems-update/ })
20+
expect(advisories.map(&:path).grep_v(/rubygems-update/))
2121
.to be_empty
2222
end
2323
end
@@ -45,7 +45,7 @@
4545
advisory.is_a?(Bundler::Audit::Advisory)
4646
end).to be_truthy
4747
expect(advisories.map(&:id)).to include('CVE-2015-1855')
48-
expect(advisories.map(&:path).reject { |p| p =~ /rubies/ }).to be_empty
48+
expect(advisories.map(&:path).grep_v(/rubies/)).to be_empty
4949
end
5050
end
5151

spec/spec_helper.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
22
require 'pry'
33
require 'ruby_audit'
4-
require 'timecop'
54

65
RSpec.configure do |config|
76
config.before(:each) do

0 commit comments

Comments
 (0)