ruby-audit-fork 3.1.0.fork.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/test.yml +27 -0
- data/.gitignore +10 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +31 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +147 -0
- data/CODE_OF_CONDUCT.md +50 -0
- data/CONTRIBUTING.md +28 -0
- data/Gemfile +11 -0
- data/LICENSE.md +13 -0
- data/README.md +99 -0
- data/Rakefile +9 -0
- data/bin/console +7 -0
- data/bin/setup +8 -0
- data/exe/ruby-audit +6 -0
- data/lib/ruby_audit/cli.rb +125 -0
- data/lib/ruby_audit/database.rb +39 -0
- data/lib/ruby_audit/scanner.rb +74 -0
- data/lib/ruby_audit/version.rb +4 -0
- data/lib/ruby_audit.rb +4 -0
- data/ruby_audit.gemspec +36 -0
- metadata +92 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e72ffe78b55ea3c17bcde4bc42ca9aaafaed8d77ffe1f622d34c5a62bd821079
|
|
4
|
+
data.tar.gz: dd9c8845368833103a824d1a39adf22c5e4bd08886282d36b92aa1f70886b9af
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 01ba661c7c087442747681dbc2f0cde674100b3acbcbfc4530be8174837cc46dee382ef638555c7253eaf6258f8100cd687631506fe42b7322ba89f3598bad23
|
|
7
|
+
data.tar.gz: 0baed4bd11e749ce25674a125b4b416ca6ecf5c371bc5ad638d7b195e5ee8e6a85045e02dd761a813f5ba6d1a80e9bce34380ba5d8141ffd5f5d85b9662c0e03
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
ruby_version: [3.1, 3.2, 3.3, 3.4, 4.0]
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v2
|
|
19
|
+
- name: Set up Ruby
|
|
20
|
+
uses: ruby/setup-ruby@v1
|
|
21
|
+
with:
|
|
22
|
+
ruby-version: ${{ matrix.ruby_version }}
|
|
23
|
+
bundler-cache: true
|
|
24
|
+
- name: Initialize submodule
|
|
25
|
+
run: git submodule update --init
|
|
26
|
+
- name: Run tests
|
|
27
|
+
run: bundle exec rake
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.1
|
|
3
|
+
NewCops: enable
|
|
4
|
+
SuggestExtensions: false
|
|
5
|
+
|
|
6
|
+
Gemspec/DevelopmentDependencies:
|
|
7
|
+
EnforcedStyle: gemspec
|
|
8
|
+
|
|
9
|
+
Layout/LineLength:
|
|
10
|
+
Exclude:
|
|
11
|
+
- 'ruby_audit.gemspec'
|
|
12
|
+
|
|
13
|
+
Metrics/MethodLength:
|
|
14
|
+
Max: 15
|
|
15
|
+
|
|
16
|
+
Metrics/BlockLength:
|
|
17
|
+
AllowedMethods:
|
|
18
|
+
- describe
|
|
19
|
+
|
|
20
|
+
Style/Documentation:
|
|
21
|
+
Enabled: false
|
|
22
|
+
|
|
23
|
+
Naming/FileName:
|
|
24
|
+
Exclude:
|
|
25
|
+
- 'exe/ruby-audit'
|
|
26
|
+
|
|
27
|
+
Style/FrozenStringLiteralComment:
|
|
28
|
+
Enabled: false
|
|
29
|
+
|
|
30
|
+
Style/NumericPredicate:
|
|
31
|
+
Enabled: false
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.0.0
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
* Use JRUBY_VERSION when checking jruby engine
|
|
11
|
+
|
|
12
|
+
## [3.1.0] - 2026-01-07
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Support for Ruby 3.4
|
|
17
|
+
- Support for Ruby 4.0
|
|
18
|
+
|
|
19
|
+
## [3.0.0] - 2025-01-09
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Bumped Rubocop dependency to 1.64.0
|
|
24
|
+
- Require MFA for rubygems operations
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
- Removed support for Ruby 2.5 through 3.0
|
|
29
|
+
- Removed Timecop dependency
|
|
30
|
+
|
|
31
|
+
## [2.3.1] - 2024-05-17
|
|
32
|
+
|
|
33
|
+
### Removed
|
|
34
|
+
|
|
35
|
+
- [#34](https://github.com/civisanalytics/ruby_audit/pull/34)
|
|
36
|
+
Removed check for stale database that no longer does anything
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- [#35](https://github.com/civisanalytics/ruby_audit/pull/35)
|
|
41
|
+
Look for rubygems advisories in the correct directory of the ruby-advisory-db
|
|
42
|
+
|
|
43
|
+
## [2.3.0] - 2024-01-10
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- Support for Ruby 3.3
|
|
48
|
+
|
|
49
|
+
## [2.2.0] - 2023-01-05
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- Support for Ruby 3.2
|
|
54
|
+
|
|
55
|
+
## [2.1.0] - 2022-02-23
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- Support for ruby 3.1
|
|
60
|
+
- Require bundler-audit >= 0.9
|
|
61
|
+
|
|
62
|
+
## [2.0.0] - 2021-03-22
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
|
|
66
|
+
- Require bundler-audit 0.8
|
|
67
|
+
- Added Ruby 3.0 to the Travis matrix
|
|
68
|
+
|
|
69
|
+
### Removed
|
|
70
|
+
|
|
71
|
+
- Removed support for bundler-audit 0.7
|
|
72
|
+
|
|
73
|
+
## [1.3.0] - 2020-07-01
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
- Added Ruby 2.5, 2.6, and 2.7 to the Travis matrix
|
|
78
|
+
- Added the ability to ignore an advisory by its GHSA identifier
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- Bumped the bundler-audit version to 0.7
|
|
83
|
+
- Bumped the Ruby version for development to 2.7.1
|
|
84
|
+
- Bumped the Pry version for development to 0.13
|
|
85
|
+
- Bumped the Rake version for development to 13
|
|
86
|
+
- Bumped the Rspec version for development to 3.9
|
|
87
|
+
- Bumped the RuboCop version for development to 0.86
|
|
88
|
+
- Bumped the Timecop verison for development to 0.9
|
|
89
|
+
- RuboCop fixes
|
|
90
|
+
|
|
91
|
+
### Removed
|
|
92
|
+
|
|
93
|
+
- Removed Ruby 2.1 through 2.4 from the Travis matrix
|
|
94
|
+
- Removed the explicit Bundler dependency for development, since it is now included with RubyGems
|
|
95
|
+
|
|
96
|
+
## [1.2.0] - 2017-09-21
|
|
97
|
+
|
|
98
|
+
### Added
|
|
99
|
+
|
|
100
|
+
- Added 2.4 to the Travis matrix ([@errm])
|
|
101
|
+
|
|
102
|
+
### Changed
|
|
103
|
+
|
|
104
|
+
- Bumped the bundler-audit version to 0.6 ([@errm])
|
|
105
|
+
- Bumped the RuboCop version for development to 0.50 ([@errm])
|
|
106
|
+
- Bumped the Ruby version for development to 2.4.2 ([@errm])
|
|
107
|
+
|
|
108
|
+
## [1.1.0] - 2016-09-15
|
|
109
|
+
|
|
110
|
+
### Added
|
|
111
|
+
|
|
112
|
+
- Added a matrix build of 2.1, 2.2, and 2.3 to Travis
|
|
113
|
+
|
|
114
|
+
### Changed
|
|
115
|
+
|
|
116
|
+
- Added a [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
117
|
+
- Bumped the bundler-audit version to 0.5
|
|
118
|
+
- Bumped the RSpec version for development to 3.5
|
|
119
|
+
- Bumped the Rake version for development to 11.2
|
|
120
|
+
- Bumped the RuboCop version for development to 0.42
|
|
121
|
+
- Bumped the Ruby version for development to 2.3.1
|
|
122
|
+
|
|
123
|
+
## [1.0.1] - 2016-02-03
|
|
124
|
+
|
|
125
|
+
### Fixed
|
|
126
|
+
|
|
127
|
+
- [#1](https://github.com/civisanalytics/ruby_audit/pull/1)
|
|
128
|
+
removing unreliable last-update check
|
|
129
|
+
|
|
130
|
+
## 1.0.0 (2016-02-03)
|
|
131
|
+
|
|
132
|
+
- Initial Release
|
|
133
|
+
|
|
134
|
+
[Unreleased]: https://github.com/civisanalytics/ruby_audit/compare/v3.1.0...HEAD
|
|
135
|
+
[3.1.0]: https://github.com/civisanalytics/ruby_audit/compare/v3.0.0...v3.1.0
|
|
136
|
+
[3.0.0]: https://github.com/civisanalytics/ruby_audit/compare/v2.3.1...v3.0.0
|
|
137
|
+
[2.3.1]: https://github.com/civisanalytics/ruby_audit/compare/v2.3.0...v2.3.1
|
|
138
|
+
[2.3.0]: https://github.com/civisanalytics/ruby_audit/compare/v2.2.0...v2.3.0
|
|
139
|
+
[2.2.0]: https://github.com/civisanalytics/ruby_audit/compare/v2.1.0...v2.2.0
|
|
140
|
+
[2.1.0]: https://github.com/civisanalytics/ruby_audit/compare/v2.0.0...v2.1.0
|
|
141
|
+
[2.0.0]: https://github.com/civisanalytics/ruby_audit/compare/v1.3.0...v2.0.0
|
|
142
|
+
[1.3.0]: https://github.com/civisanalytics/ruby_audit/compare/v1.2.0...v1.3.0
|
|
143
|
+
[1.2.0]: https://github.com/civisanalytics/ruby_audit/compare/v1.1.0...v1.2.0
|
|
144
|
+
[1.1.0]: https://github.com/civisanalytics/ruby_audit/compare/v1.0.1...v1.1.0
|
|
145
|
+
[1.0.1]: https://github.com/civisanalytics/ruby_audit/compare/v1.0.0...v1.0.1
|
|
146
|
+
[1.0.0]: https://github.com/civisanalytics/ruby_audit/commit/7535b70412641c888c80d99514b27ba254fb8316
|
|
147
|
+
[@errm]: https://github.com/errm
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
|
7
|
+
|
|
8
|
+
We are committed to making participation in this project a harassment-free
|
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
|
12
|
+
|
|
13
|
+
Examples of unacceptable behavior by participants include:
|
|
14
|
+
|
|
15
|
+
* The use of sexualized language or imagery
|
|
16
|
+
* Personal attacks
|
|
17
|
+
* Trolling or insulting/derogatory comments
|
|
18
|
+
* Public or private harassment
|
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
|
20
|
+
addresses, without explicit permission
|
|
21
|
+
* Other unethical or unprofessional conduct
|
|
22
|
+
|
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
27
|
+
threatening, offensive, or harmful.
|
|
28
|
+
|
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
|
32
|
+
Conduct may be permanently removed from the project team.
|
|
33
|
+
|
|
34
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
35
|
+
when an individual is representing the project or its community.
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
38
|
+
reported by contacting a project maintainer at opensource@civisanalytics.com.
|
|
39
|
+
All complaints will be reviewed and investigated and will result in a response
|
|
40
|
+
that is deemed necessary and appropriate to the circumstances. Maintainers are
|
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
42
|
+
incident.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
46
|
+
version 1.3.0, available at
|
|
47
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
|
48
|
+
|
|
49
|
+
[homepage]: http://contributor-covenant.org
|
|
50
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Contributing to RubyAudit
|
|
2
|
+
|
|
3
|
+
We welcome bug reports and pull requests from everyone!
|
|
4
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
5
|
+
|
|
6
|
+
## Getting Started
|
|
7
|
+
|
|
8
|
+
1. Fork it ( https://github.com/civisanalytics/ruby_audit/fork )
|
|
9
|
+
2. Install the development dependencies (`bundle install`)
|
|
10
|
+
3. Make sure you are able to run the test suite locally (`rake`)
|
|
11
|
+
4. Create a feature branch (`git checkout -b my-new-feature`)
|
|
12
|
+
5. Make your change. Don't forget tests
|
|
13
|
+
6. Make sure the test suite, including your new tests, passes (`rake`)
|
|
14
|
+
7. Commit your changes (`git commit -am 'Add some feature'`)
|
|
15
|
+
8. Push to the branch (`git push origin my-new-feature`)
|
|
16
|
+
9. Create a new pull request
|
|
17
|
+
10. If the Travis build fails, address any issues
|
|
18
|
+
|
|
19
|
+
## Tips
|
|
20
|
+
|
|
21
|
+
- All pull requests must include test coverage. If you're not sure how to test
|
|
22
|
+
your changes, feel free to ask for help.
|
|
23
|
+
- Contributions must conform to the
|
|
24
|
+
[Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide).
|
|
25
|
+
- Don't forget to add your change to the [CHANGELOG](CHANGELOG.md). See
|
|
26
|
+
[Keep a CHANGELOG](http://keepachangelog.com/) for guidelines.
|
|
27
|
+
|
|
28
|
+
Thank you for taking the time to contribute to RubyAudit!
|
data/Gemfile
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in ruby_audit.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
gem 'base64', '~> 0.2.0'
|
|
7
|
+
gem 'ostruct', '~> 0.6.1'
|
|
8
|
+
gem 'pry', '~> 0.14.1'
|
|
9
|
+
gem 'rake', '~> 13.0'
|
|
10
|
+
gem 'rspec', '~> 3.9'
|
|
11
|
+
gem 'rubocop', '~> 1.69.2'
|
data/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright (C) 2016 Civis Analytics
|
|
2
|
+
|
|
3
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
4
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
5
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
6
|
+
version.
|
|
7
|
+
|
|
8
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
9
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
10
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
11
|
+
|
|
12
|
+
You should have received a copy of the GNU General Public License along with
|
|
13
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
data/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# RubyAudit Fork
|
|
2
|
+
|
|
3
|
+
[](http://badge.fury.io/rb/ruby-audit-fork)
|
|
4
|
+
|
|
5
|
+
> **⚠️ This is a fork of [ruby_audit](https://github.com/civisanalytics/ruby_audit) with JRuby compatibility fixes**
|
|
6
|
+
>
|
|
7
|
+
> The original gem is available at: https://rubygems.org/gems/ruby_audit
|
|
8
|
+
>
|
|
9
|
+
> This fork includes JRuby compatibility fixes that may not yet be merged upstream.
|
|
10
|
+
> **All development, bug reports, and contributions should go to the original project:**
|
|
11
|
+
> https://github.com/civisanalytics/ruby_audit
|
|
12
|
+
>
|
|
13
|
+
> This is NOT a maintained fork. It's published for users who need JRuby compatibility.
|
|
14
|
+
|
|
15
|
+
## About
|
|
16
|
+
|
|
17
|
+
RubyAudit checks your current version of Ruby and RubyGems against known security vulnerabilities (CVEs), alerting you if you are using an insecure version.
|
|
18
|
+
It complements [bundler-audit](https://github.com/rubysec/bundler-audit), providing complete coverage for your Ruby stack.
|
|
19
|
+
If you use Bundler, you should use both RubyAudit and bundler-audit.
|
|
20
|
+
|
|
21
|
+
RubyAudit is based on and leverages bundler-audit, and would not exist without the hard work of the [rubysec](https://github.com/rubysec) team, specifically bundler-audit and [ruby-advisory-db](https://github.com/rubysec/ruby-advisory-db).
|
|
22
|
+
|
|
23
|
+
"If I have seen further it is by standing on the shoulders of Giants." -- Isaac Newton
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Add this line to your application's Gemfile:
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
gem 'ruby-audit-fork'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
And then execute:
|
|
34
|
+
|
|
35
|
+
$ bundle
|
|
36
|
+
|
|
37
|
+
Or install it yourself as:
|
|
38
|
+
|
|
39
|
+
$ gem install ruby-audit-fork
|
|
40
|
+
|
|
41
|
+
### Why use this fork?
|
|
42
|
+
|
|
43
|
+
Use this fork if you need JRuby compatibility. The original `ruby_audit` gem is available
|
|
44
|
+
at https://rubygems.org/gems/ruby_audit - use that unless you specifically need the JRuby fixes.
|
|
45
|
+
|
|
46
|
+
This fork includes:
|
|
47
|
+
- JRuby compatibility fix (use JRUBY_VERSION when checking jruby engine)
|
|
48
|
+
|
|
49
|
+
The executable and API are identical to the original.
|
|
50
|
+
|
|
51
|
+
Because bundler-audit requires bundler, RubyAudit requires bundler as a transitive
|
|
52
|
+
dependency. If you don't intend to run RubyAudit in the production environment, you
|
|
53
|
+
may selectively install it in your development and test environments by using
|
|
54
|
+
[Bundler groups](https://bundler.io/guides/groups.html).
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
To check your current version of Ruby and RubyGems:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
$ ruby-audit check
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
You can ignore specific advisories by specifying `-i <advisory>`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
$ ruby-audit check -i CVE-2015-7551
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
By default, RubyAudit will check for updates to the ruby-advisory-db when it runs.
|
|
71
|
+
If you are using RubyAudit offline, you can bypass this check by specifying `-n`:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
$ ruby-audit check -n
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
|
80
|
+
You'll also want to run `git submodule update --init` to populate the ruby-advisory-db
|
|
81
|
+
submodule in `/vendor` that is used for testing. Then, run `rake` to run linting and tests.
|
|
82
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
83
|
+
|
|
84
|
+
The database in `/vendor/ruby-advisory-db` is only used as a fixture for unit tests.
|
|
85
|
+
By default, the database used for actual vulnerability checks is stored at `~/.local/share/ruby-advisory-db`.
|
|
86
|
+
|
|
87
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
88
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
89
|
+
|
|
90
|
+
## Contributing
|
|
91
|
+
|
|
92
|
+
**Please contribute to the original project:** https://github.com/civisanalytics/ruby_audit
|
|
93
|
+
|
|
94
|
+
This fork is not actively maintained. All bug reports, feature requests, and pull requests
|
|
95
|
+
should be directed to the upstream repository.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
RubyAudit is released under the [GNU General Public License version 3](LICENSE.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
data/exe/ruby-audit
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
|
|
3
|
+
module RubyAudit
|
|
4
|
+
class CLI < ::Thor
|
|
5
|
+
default_task :check
|
|
6
|
+
map '--version' => :version
|
|
7
|
+
|
|
8
|
+
desc 'check', 'Checks Ruby and RubyGems for insecure versions'
|
|
9
|
+
method_option :ignore, type: :array, aliases: '-i'
|
|
10
|
+
method_option :no_update, type: :boolean, aliases: '-n'
|
|
11
|
+
method_option :verbose, type: :boolean, aliases: '-v'
|
|
12
|
+
def check
|
|
13
|
+
update unless options[:no_update]
|
|
14
|
+
|
|
15
|
+
scanner = Scanner.new
|
|
16
|
+
vulnerable = false
|
|
17
|
+
|
|
18
|
+
scanner.scan(ignore: options[:ignore]) do |result|
|
|
19
|
+
vulnerable = true
|
|
20
|
+
print_advisory result.gem, result.advisory
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if vulnerable
|
|
24
|
+
say 'Vulnerabilities found!', :red
|
|
25
|
+
exit 1
|
|
26
|
+
else
|
|
27
|
+
say 'No vulnerabilities found', :green
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
desc 'update', 'Updates the ruby-advisory-db'
|
|
32
|
+
def update
|
|
33
|
+
say 'Updating ruby-advisory-db ...'
|
|
34
|
+
|
|
35
|
+
case Database.update!
|
|
36
|
+
when true
|
|
37
|
+
say 'Updated ruby-advisory-db', :green
|
|
38
|
+
when false
|
|
39
|
+
say 'Failed updating ruby-advisory-db!', :red
|
|
40
|
+
exit 1
|
|
41
|
+
when nil
|
|
42
|
+
say 'Skipping update', :yellow
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
database = Database.new
|
|
46
|
+
puts "ruby-advisory-db: #{database.size} advisories, " \
|
|
47
|
+
"last updated #{database.last_updated_at.utc}"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
desc 'version', 'Prints the ruby-audit version'
|
|
51
|
+
def version
|
|
52
|
+
database = Database.new
|
|
53
|
+
puts "#{File.basename($PROGRAM_NAME)} #{VERSION} " \
|
|
54
|
+
"(advisories: #{database.size}, last updated: #{database.last_updated_at.utc})"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def say(message = '', color = nil)
|
|
60
|
+
color = nil unless $stdout.tty?
|
|
61
|
+
super(message.to_s, color)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# rubocop:disable Metrics/AbcSize
|
|
65
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
|
66
|
+
# rubocop:disable Metrics/MethodLength
|
|
67
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
|
68
|
+
def print_advisory(gem, advisory)
|
|
69
|
+
say 'Name: ', :red
|
|
70
|
+
say gem.name
|
|
71
|
+
|
|
72
|
+
say 'Version: ', :red
|
|
73
|
+
say gem.version
|
|
74
|
+
|
|
75
|
+
say 'Advisory: ', :red
|
|
76
|
+
|
|
77
|
+
if advisory.cve
|
|
78
|
+
say advisory.cve_id
|
|
79
|
+
elsif advisory.osvdb
|
|
80
|
+
say advisory.osvdb_id
|
|
81
|
+
elsif advisory.ghsa
|
|
82
|
+
say advisory.ghsa_id
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
say 'Criticality: ', :red
|
|
86
|
+
case advisory.criticality
|
|
87
|
+
when :none then say 'None'
|
|
88
|
+
when :low then say 'Low'
|
|
89
|
+
when :medium then say 'Medium', :yellow
|
|
90
|
+
when :high then say 'High', %i[red bold]
|
|
91
|
+
when :critical then say 'Critical', %i[red bold]
|
|
92
|
+
else say 'Unknown'
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
say 'URL: ', :red
|
|
96
|
+
say advisory.url
|
|
97
|
+
|
|
98
|
+
if options.verbose?
|
|
99
|
+
say 'Description:', :red
|
|
100
|
+
say
|
|
101
|
+
|
|
102
|
+
print_wrapped advisory.description, indent: 2
|
|
103
|
+
say
|
|
104
|
+
else
|
|
105
|
+
|
|
106
|
+
say 'Title: ', :red
|
|
107
|
+
say advisory.title
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if advisory.patched_versions.empty?
|
|
111
|
+
say 'Solution: ', :red
|
|
112
|
+
say 'remove or disable this gem until a patch is available!', %i[red bold]
|
|
113
|
+
else
|
|
114
|
+
say 'Solution: upgrade to ', :red
|
|
115
|
+
say advisory.patched_versions.join(', ')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
say
|
|
119
|
+
end
|
|
120
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
|
121
|
+
# rubocop:enable Metrics/MethodLength
|
|
122
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
|
123
|
+
# rubocop:enable Metrics/AbcSize
|
|
124
|
+
end
|
|
125
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'bundler/audit/database'
|
|
2
|
+
|
|
3
|
+
module RubyAudit
|
|
4
|
+
class Database < Bundler::Audit::Database
|
|
5
|
+
def advisories_for(name, type)
|
|
6
|
+
return enum_for(__method__, name, type) unless block_given?
|
|
7
|
+
|
|
8
|
+
each_advisory_path_for(name, type) do |path|
|
|
9
|
+
yield Bundler::Audit::Advisory.load(path)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def check_ruby(ruby, &)
|
|
14
|
+
check(ruby, 'rubies', &)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def check_rubygems(rubygems, &)
|
|
18
|
+
check(rubygems, 'gems', &)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def check(object, type = 'gems')
|
|
22
|
+
return enum_for(__method__, object, type) unless block_given?
|
|
23
|
+
|
|
24
|
+
advisories_for(object.name, type) do |advisory|
|
|
25
|
+
yield advisory if advisory.vulnerable?(object.version)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
protected
|
|
30
|
+
|
|
31
|
+
def each_advisory_path(&)
|
|
32
|
+
Dir.glob(File.join(@path, '{gems,rubies}', '*', '*.yml'), &)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def each_advisory_path_for(name, type = 'gems', &)
|
|
36
|
+
Dir.glob(File.join(@path, type, name, '*.yml'), &)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
require 'bundler/audit/results/unpatched_gem'
|
|
2
|
+
require 'set'
|
|
3
|
+
|
|
4
|
+
module RubyAudit
|
|
5
|
+
class Scanner
|
|
6
|
+
class Version
|
|
7
|
+
def initialize(name, version)
|
|
8
|
+
@name = name
|
|
9
|
+
@version = Gem::Version.new(version)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attr_reader :name, :version
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def initialize
|
|
16
|
+
@database = Database.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def scan(options = {}, &block)
|
|
20
|
+
return enum_for(__method__, options) unless block
|
|
21
|
+
|
|
22
|
+
scan_ruby(options, &block)
|
|
23
|
+
scan_rubygems(options, &block)
|
|
24
|
+
|
|
25
|
+
self
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def scan_ruby(options = {}, &block)
|
|
29
|
+
version = if RUBY_ENGINE == "jruby"
|
|
30
|
+
"#{JRUBY_VERSION}"
|
|
31
|
+
elsif RUBY_PATCHLEVEL < 0
|
|
32
|
+
ruby_version
|
|
33
|
+
else
|
|
34
|
+
"#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"
|
|
35
|
+
end
|
|
36
|
+
specs = [Version.new(RUBY_ENGINE, version)]
|
|
37
|
+
scan_inner(specs, 'ruby', options, &block)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def scan_rubygems(options = {}, &)
|
|
41
|
+
specs = [Version.new('rubygems-update', rubygems_version)]
|
|
42
|
+
scan_inner(specs, 'rubygems', options, &)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def ruby_version
|
|
48
|
+
# .gsub to separate strings (e.g., 2.1.0dev -> 2.1.0.dev,
|
|
49
|
+
# 2.2.0preview1 -> 2.2.0.preview.1).
|
|
50
|
+
`ruby --version`.split[1]
|
|
51
|
+
.gsub(/(\d)([a-z]+)/, '\1.\2')
|
|
52
|
+
.gsub(/([a-z]+)(\d)/, '\1.\2')
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def rubygems_version
|
|
56
|
+
`gem --version`.strip
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def scan_inner(specs, type, options = {})
|
|
60
|
+
return enum_for(__method__, specs, type, options) unless block_given?
|
|
61
|
+
|
|
62
|
+
ignore = Set[]
|
|
63
|
+
ignore += options[:ignore] if options[:ignore]
|
|
64
|
+
|
|
65
|
+
specs.each do |spec|
|
|
66
|
+
@database.send(:"check_#{type}", spec) do |advisory|
|
|
67
|
+
unless ignore.intersect?(advisory.identifiers.to_set)
|
|
68
|
+
yield Bundler::Audit::Results::UnpatchedGem.new(spec, advisory)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
data/lib/ruby_audit.rb
ADDED
data/ruby_audit.gemspec
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'ruby_audit/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'ruby-audit-fork'
|
|
7
|
+
spec.version = RubyAudit::VERSION
|
|
8
|
+
spec.authors = ['Jeff Cousens, Mike Saelim', 'John Zhang', 'Cristina Muñoz']
|
|
9
|
+
spec.email = ['opensource@civisanalytics.com']
|
|
10
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
11
|
+
|
|
12
|
+
spec.summary = 'Checks Ruby and RubyGems against known vulnerabilities (Fork with JRuby compatibility).'
|
|
13
|
+
spec.description = 'RubyAudit checks your current version of Ruby and ' \
|
|
14
|
+
'RubyGems against known security vulnerabilities ' \
|
|
15
|
+
'(CVEs), alerting you if you are using an insecure ' \
|
|
16
|
+
'version. It complements bundler-audit, providing ' \
|
|
17
|
+
'complete coverage for your Ruby stack. ' \
|
|
18
|
+
'This is a fork of ruby_audit (https://rubygems.org/gems/ruby_audit) ' \
|
|
19
|
+
'with JRuby compatibility fixes. Use the original gem unless you need JRuby support. ' \
|
|
20
|
+
'All development happens upstream at https://github.com/civisanalytics/ruby_audit'
|
|
21
|
+
spec.homepage = 'https://github.com/jiop/ruby_audit'
|
|
22
|
+
spec.license = 'GPL-3.0-or-later'
|
|
23
|
+
|
|
24
|
+
spec.metadata['source_code_uri'] = 'https://github.com/jiop/ruby_audit'
|
|
25
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/jiop/ruby_audit/issues'
|
|
26
|
+
spec.metadata['changelog_uri'] = 'https://github.com/jiop/ruby_audit/blob/main/CHANGELOG.md'
|
|
27
|
+
spec.metadata['original_project'] = 'https://github.com/civisanalytics/ruby_audit'
|
|
28
|
+
|
|
29
|
+
spec.required_ruby_version = ['>= 3.1', '< 4.1']
|
|
30
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
31
|
+
spec.bindir = 'exe'
|
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
33
|
+
spec.require_paths = ['lib']
|
|
34
|
+
|
|
35
|
+
spec.add_dependency 'bundler-audit', '~> 0.9.0'
|
|
36
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ruby-audit-fork
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 3.1.0.fork.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jeff Cousens, Mike Saelim
|
|
8
|
+
- John Zhang
|
|
9
|
+
- Cristina Muñoz
|
|
10
|
+
bindir: exe
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: bundler-audit
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - "~>"
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: 0.9.0
|
|
21
|
+
type: :runtime
|
|
22
|
+
prerelease: false
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
25
|
+
- - "~>"
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: 0.9.0
|
|
28
|
+
description: RubyAudit checks your current version of Ruby and RubyGems against known
|
|
29
|
+
security vulnerabilities (CVEs), alerting you if you are using an insecure version.
|
|
30
|
+
It complements bundler-audit, providing complete coverage for your Ruby stack. This
|
|
31
|
+
is a fork of ruby_audit (https://rubygems.org/gems/ruby_audit) with JRuby compatibility
|
|
32
|
+
fixes. Use the original gem unless you need JRuby support. All development happens
|
|
33
|
+
upstream at https://github.com/civisanalytics/ruby_audit
|
|
34
|
+
email:
|
|
35
|
+
- opensource@civisanalytics.com
|
|
36
|
+
executables:
|
|
37
|
+
- ruby-audit
|
|
38
|
+
extensions: []
|
|
39
|
+
extra_rdoc_files: []
|
|
40
|
+
files:
|
|
41
|
+
- ".github/workflows/test.yml"
|
|
42
|
+
- ".gitignore"
|
|
43
|
+
- ".gitmodules"
|
|
44
|
+
- ".rspec"
|
|
45
|
+
- ".rubocop.yml"
|
|
46
|
+
- ".ruby-version"
|
|
47
|
+
- CHANGELOG.md
|
|
48
|
+
- CODE_OF_CONDUCT.md
|
|
49
|
+
- CONTRIBUTING.md
|
|
50
|
+
- Gemfile
|
|
51
|
+
- LICENSE.md
|
|
52
|
+
- README.md
|
|
53
|
+
- Rakefile
|
|
54
|
+
- bin/console
|
|
55
|
+
- bin/setup
|
|
56
|
+
- exe/ruby-audit
|
|
57
|
+
- lib/ruby_audit.rb
|
|
58
|
+
- lib/ruby_audit/cli.rb
|
|
59
|
+
- lib/ruby_audit/database.rb
|
|
60
|
+
- lib/ruby_audit/scanner.rb
|
|
61
|
+
- lib/ruby_audit/version.rb
|
|
62
|
+
- ruby_audit.gemspec
|
|
63
|
+
homepage: https://github.com/jiop/ruby_audit
|
|
64
|
+
licenses:
|
|
65
|
+
- GPL-3.0-or-later
|
|
66
|
+
metadata:
|
|
67
|
+
rubygems_mfa_required: 'true'
|
|
68
|
+
source_code_uri: https://github.com/jiop/ruby_audit
|
|
69
|
+
bug_tracker_uri: https://github.com/jiop/ruby_audit/issues
|
|
70
|
+
changelog_uri: https://github.com/jiop/ruby_audit/blob/main/CHANGELOG.md
|
|
71
|
+
original_project: https://github.com/civisanalytics/ruby_audit
|
|
72
|
+
rdoc_options: []
|
|
73
|
+
require_paths:
|
|
74
|
+
- lib
|
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '3.1'
|
|
80
|
+
- - "<"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '4.1'
|
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '0'
|
|
88
|
+
requirements: []
|
|
89
|
+
rubygems_version: 4.0.3
|
|
90
|
+
specification_version: 4
|
|
91
|
+
summary: Checks Ruby and RubyGems against known vulnerabilities (Fork with JRuby compatibility).
|
|
92
|
+
test_files: []
|