iron_dome 0.1.2 → 0.1.4
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 +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +17 -1
- data/README.md +17 -0
- data/iron_dome.gemspec +38 -0
- data/lib/iron_dome/reader.rb +26 -22
- data/lib/iron_dome/version.rb +1 -1
- data/lib/iron_dome.rb +18 -1
- metadata +5 -5
- data/sig/iron_dome.rbs +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a78ecb0117de214b26c07cfcbe0bb9656f1c5cd1c42aa9db5ca40709959f854
|
|
4
|
+
data.tar.gz: 253148e1c1be2caeddc6cfb71083bb1038859d648d25fde208933f9b1f0be0f5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee17272c99ec3f66ce139214653c6685e208cb6b45a915be8577d4d7a858c0c8c505eb00fbe776118a26a7c96d5958b44807cbcc6f127d26cb644c4ee230a079
|
|
7
|
+
data.tar.gz: cfaa3937060d92c5ec20898c1d2d09334f2f67e8ab79a8fe1e22b2873a85b738a92afee2750cad8b55a7c4648e0b0b7c6cc5bc5e4dd97f8d1609070db7985b1b
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
## [
|
|
1
|
+
## [released]
|
|
2
2
|
|
|
3
3
|
## [0.1.0] - 2024-01-20
|
|
4
4
|
|
|
5
5
|
- Initial release
|
|
6
|
+
|
|
7
|
+
## [released]
|
|
8
|
+
|
|
9
|
+
## [0.1.2] - 2024-02-20
|
|
10
|
+
|
|
11
|
+
- Support sarif output
|
|
12
|
+
- Suport output on terminal
|
|
13
|
+
- General improvements
|
|
14
|
+
|
|
15
|
+
## [released]
|
|
16
|
+
|
|
17
|
+
## [0.1.3] - 2024-03-02
|
|
18
|
+
|
|
19
|
+
- Improvement in code architecture
|
|
20
|
+
- Improvement in specs
|
|
21
|
+
- When -o or --output is given as a param, theres no output on terminal only on a sarif file
|
data/README.md
CHANGED
|
@@ -14,10 +14,27 @@ this directory must have the Gemfile.lock, you can also run on a ci/cd pipeline.
|
|
|
14
14
|
|
|
15
15
|
$ iron_dome
|
|
16
16
|
|
|
17
|
+
### Theres some optional params you can use, like, -o or --output and -d or --detail
|
|
18
|
+
|
|
19
|
+
This will generate a sarif file format.
|
|
20
|
+
|
|
21
|
+
$ iron_dome -o
|
|
22
|
+
$ iron_dome --output
|
|
23
|
+
|
|
24
|
+
This will show details on the current shell session like the output example below.
|
|
25
|
+
|
|
26
|
+
$ iron_dome -d
|
|
27
|
+
$ iron_dome --detail
|
|
28
|
+
|
|
17
29
|
## Output Example
|
|
18
30
|
|
|
19
31
|

|
|
20
32
|
|
|
33
|
+
## Supported language and lockfile format
|
|
34
|
+
|
|
35
|
+
| Ruby | Gemfile.lock |
|
|
36
|
+
|-----------|-----------------|
|
|
37
|
+
|
|
21
38
|
## Development
|
|
22
39
|
|
|
23
40
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/iron_dome.gemspec
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/iron_dome/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "iron_dome"
|
|
7
|
+
spec.version = IronDome::VERSION
|
|
8
|
+
spec.authors = ["Jose Augusto"]
|
|
9
|
+
spec.email = ["joseaugusto.881@outlook.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "A vulnerability scanner for ruby projects dependencies"
|
|
12
|
+
spec.homepage = "https://github.com/JAugusto42/iron_dome"
|
|
13
|
+
spec.license = "MIT"
|
|
14
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
15
|
+
|
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/JAugusto42/iron_dome"
|
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/JAugusto42/iron_dome/CHANGELOG.md"
|
|
19
|
+
|
|
20
|
+
spec.executables << "iron_dome"
|
|
21
|
+
|
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
26
|
+
(File.expand_path(f) == __FILE__) ||
|
|
27
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
spec.bindir = "exe"
|
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
32
|
+
spec.require_paths = ["lib"]
|
|
33
|
+
|
|
34
|
+
spec.add_dependency "colorize", "~> 1.1"
|
|
35
|
+
spec.add_dependency "concurrent-ruby", "~> 1.2"
|
|
36
|
+
spec.add_dependency "faraday", "~> 2.9"
|
|
37
|
+
spec.add_dependency "rake", "~> 13.0"
|
|
38
|
+
end
|
data/lib/iron_dome/reader.rb
CHANGED
|
@@ -10,15 +10,19 @@ module IronDome
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def call
|
|
13
|
-
|
|
13
|
+
read_lock_file
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
private
|
|
17
17
|
|
|
18
|
-
def
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
def read_lock_file
|
|
19
|
+
lock_file = Dir.glob("Gemfile.lock")
|
|
20
|
+
if lock_file.empty?
|
|
21
|
+
puts "Not able to find Gemfile.lock ..."
|
|
22
|
+
return
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
lock_file.map { |file| process_lock_file(file) }
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def process_lock_file(file)
|
|
@@ -27,7 +31,7 @@ module IronDome
|
|
|
27
31
|
puts "Verifying vulnerabilities on osv database ..."
|
|
28
32
|
results = Requester.osv_request(packages_and_versions)
|
|
29
33
|
results.compact!
|
|
30
|
-
system_output(results)
|
|
34
|
+
system_output(results) unless options[:sarif_output] == true
|
|
31
35
|
output_sarif_file_format(results) if options[:sarif_output] == true
|
|
32
36
|
end
|
|
33
37
|
|
|
@@ -35,7 +39,7 @@ module IronDome
|
|
|
35
39
|
# method to call the module to generate the sarif report
|
|
36
40
|
puts "Generating the sarif output ..."
|
|
37
41
|
IronDome::Sarif::Output.new.output_report(results)
|
|
38
|
-
puts "Sarif file
|
|
42
|
+
puts "Sarif file outputted"
|
|
39
43
|
end
|
|
40
44
|
|
|
41
45
|
def system_output(results)
|
|
@@ -50,35 +54,35 @@ module IronDome
|
|
|
50
54
|
|
|
51
55
|
def build_output(results)
|
|
52
56
|
# Build the terminal output but maybe we will need to improve this methods.
|
|
53
|
-
|
|
57
|
+
total_vulnerabilities = 0
|
|
54
58
|
|
|
55
|
-
puts ":: Vulnerabilities found:"
|
|
59
|
+
puts ":: Vulnerabilities found:".colorize(:red)
|
|
56
60
|
results.each do |result|
|
|
57
|
-
result["vulns"].each do |
|
|
58
|
-
print_vulnerability_info(
|
|
59
|
-
|
|
61
|
+
result["vulns"].each do |vulnerability|
|
|
62
|
+
print_vulnerability_info(vulnerability)
|
|
63
|
+
total_vulnerabilities += 1
|
|
60
64
|
end
|
|
61
65
|
end
|
|
62
66
|
|
|
63
|
-
puts "#{
|
|
67
|
+
puts "#{total_vulnerabilities} vulnerabilities founded.".colorize(:light_red)
|
|
64
68
|
end
|
|
65
69
|
|
|
66
|
-
def print_vulnerability_info(
|
|
67
|
-
package_name = extract_package_name(
|
|
68
|
-
version_fixed = extract_version_fixed(
|
|
69
|
-
summary =
|
|
70
|
-
details =
|
|
70
|
+
def print_vulnerability_info(vulnerabilities)
|
|
71
|
+
package_name = extract_package_name(vulnerabilities)
|
|
72
|
+
version_fixed = extract_version_fixed(vulnerabilities)
|
|
73
|
+
summary = vulnerabilities["summary"]
|
|
74
|
+
details = vulnerabilities["details"]
|
|
71
75
|
|
|
72
76
|
print_info(package_name, version_fixed, summary, details)
|
|
73
77
|
end
|
|
74
78
|
|
|
75
|
-
def extract_package_name(
|
|
76
|
-
affected_package =
|
|
79
|
+
def extract_package_name(vulnerability)
|
|
80
|
+
affected_package = vulnerability["affected"].first
|
|
77
81
|
affected_package["package"]["name"]
|
|
78
82
|
end
|
|
79
83
|
|
|
80
|
-
def extract_version_fixed(
|
|
81
|
-
affected_package =
|
|
84
|
+
def extract_version_fixed(vulnerability)
|
|
85
|
+
affected_package = vulnerability["affected"].first
|
|
82
86
|
version_ranges = affected_package["ranges"].first
|
|
83
87
|
version_ranges["events"].last["fixed"]
|
|
84
88
|
end
|
data/lib/iron_dome/version.rb
CHANGED
data/lib/iron_dome.rb
CHANGED
|
@@ -14,9 +14,12 @@ require_relative "iron_dome/reader"
|
|
|
14
14
|
module IronDome
|
|
15
15
|
class Error < StandardError; end
|
|
16
16
|
|
|
17
|
-
# class entry, this is the
|
|
17
|
+
# class entry, this is the main class of the gem.
|
|
18
18
|
class Entry
|
|
19
|
+
# rubocop:disable Metrics/MethodLength
|
|
19
20
|
def main
|
|
21
|
+
puts display_ascii_art
|
|
22
|
+
|
|
20
23
|
options = {}
|
|
21
24
|
OptionParser.new do |opts|
|
|
22
25
|
opts.on("-o", "--output", "Generate a sarif format file report.") do |output|
|
|
@@ -30,5 +33,19 @@ module IronDome
|
|
|
30
33
|
|
|
31
34
|
Reader.new(options).call
|
|
32
35
|
end
|
|
36
|
+
# rubocop:enable Metrics/MethodLength
|
|
37
|
+
|
|
38
|
+
def display_ascii_art
|
|
39
|
+
<<-ART
|
|
40
|
+
|
|
41
|
+
██╗██████╗ ██████╗ ███╗ ██╗██████╗ ██████╗ ███╗ ███╗███████╗
|
|
42
|
+
██║██╔══██╗██╔═══██╗████╗ ██║██╔══██╗██╔═══██╗████╗ ████║██╔════╝
|
|
43
|
+
██║██████╔╝██║ ██║██╔██╗ ██║██║ ██║██║ ██║██╔████╔██║█████╗
|
|
44
|
+
██║██╔══██╗██║ ██║██║╚██╗██║██║ ██║██║ ██║██║╚██╔╝██║██╔══╝
|
|
45
|
+
██║██║ ██║╚██████╔╝██║ ╚████║██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗
|
|
46
|
+
╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ v#{IronDome::VERSION}
|
|
47
|
+
|
|
48
|
+
ART
|
|
49
|
+
end
|
|
33
50
|
end
|
|
34
51
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iron_dome
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jose Augusto
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: colorize
|
|
@@ -83,13 +83,13 @@ files:
|
|
|
83
83
|
- Rakefile
|
|
84
84
|
- exe/iron_dome
|
|
85
85
|
- image.png
|
|
86
|
+
- iron_dome.gemspec
|
|
86
87
|
- lib/iron_dome.rb
|
|
87
88
|
- lib/iron_dome/output.rb
|
|
88
89
|
- lib/iron_dome/reader.rb
|
|
89
90
|
- lib/iron_dome/requester.rb
|
|
90
91
|
- lib/iron_dome/sarif/output.rb
|
|
91
92
|
- lib/iron_dome/version.rb
|
|
92
|
-
- sig/iron_dome.rbs
|
|
93
93
|
homepage: https://github.com/JAugusto42/iron_dome
|
|
94
94
|
licenses:
|
|
95
95
|
- MIT
|
|
@@ -105,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
105
105
|
requirements:
|
|
106
106
|
- - ">="
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
|
-
version:
|
|
108
|
+
version: 3.0.0
|
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
requirements:
|
|
111
111
|
- - ">="
|
|
112
112
|
- !ruby/object:Gem::Version
|
|
113
113
|
version: '0'
|
|
114
114
|
requirements: []
|
|
115
|
-
rubygems_version: 3.5.
|
|
115
|
+
rubygems_version: 3.5.14
|
|
116
116
|
signing_key:
|
|
117
117
|
specification_version: 4
|
|
118
118
|
summary: A vulnerability scanner for ruby projects dependencies
|
data/sig/iron_dome.rbs
DELETED