security_report 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0415e271e2c6ac392c09173d4b1b4cb5522e1e63
4
- data.tar.gz: 9a4cb354f2c6bd5ebe242012e96746aef80b9b93
2
+ SHA256:
3
+ metadata.gz: e200510386d7cec8e885bc8273b8d2ab6805b8d4f5301b6b2a8323218780bcec
4
+ data.tar.gz: f9aaf71856a68ca43fa28e59ec4eeeb39d2f72cd4c436bfb0f250c0891273137
5
5
  SHA512:
6
- metadata.gz: 514d0547fd8c5a66585d4756a5c144af3714a53e371ae3117cdabf2f94e6a01361879cc20071fb167acd3d65b6c48900d91cfa40a5a0818577e6aeb0992d7428
7
- data.tar.gz: 607906c9ecdee7423f45a01af18acb429dba01b0ff22229a93ac417510989d14ab982f700ca95713da98b81e474c63249036acfd9a61260bb35d86a662dd7dd6
6
+ metadata.gz: f23c6d59f2f45f63c4c0d03c4f3bbb234319162726bd9733a46f42a5964ad8986bbaba1e556ced48b3ca2edad663584e18b01338f4a7e661b0c014d625139133
7
+ data.tar.gz: 995b4308b4d1a4e2f21eb16df7b94d67dce0e53f2760eb1a5e061c7b8d82ec20873ec021516cd3c59842b5a5d33299b55dd335178cfed2fc64cd8b43dd4687c3
data/Gemfile.lock CHANGED
@@ -1,46 +1,46 @@
1
- PATH
2
- remote: .
3
- specs:
4
- security_report (0.1.1)
5
- bundler-audit (~> 0.6)
6
- clap (~> 1.0)
7
- terminal-table (~> 1.8)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- bundler-audit (0.6.0)
13
- bundler (~> 1.2)
14
- thor (~> 0.18)
15
- clap (1.0.0)
16
- diff-lcs (1.3)
17
- rake (12.3.1)
18
- rspec (3.8.0)
19
- rspec-core (~> 3.8.0)
20
- rspec-expectations (~> 3.8.0)
21
- rspec-mocks (~> 3.8.0)
22
- rspec-core (3.8.0)
23
- rspec-support (~> 3.8.0)
24
- rspec-expectations (3.8.1)
25
- diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.8.0)
27
- rspec-mocks (3.8.0)
28
- diff-lcs (>= 1.2.0, < 2.0)
29
- rspec-support (~> 3.8.0)
30
- rspec-support (3.8.0)
31
- terminal-table (1.8.0)
32
- unicode-display_width (~> 1.1, >= 1.1.1)
33
- thor (0.20.0)
34
- unicode-display_width (1.4.0)
35
-
36
- PLATFORMS
37
- ruby
38
-
39
- DEPENDENCIES
40
- bundler (~> 1.16)
41
- rake (~> 12.3)
42
- rspec (~> 3.0)
43
- security_report!
44
-
45
- BUNDLED WITH
46
- 1.16.3
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ security_report (0.1.2)
5
+ bundler-audit (~> 0.8)
6
+ clap (~> 1.0)
7
+ terminal-table (~> 3.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ bundler-audit (0.8.0)
13
+ bundler (>= 1.2.0, < 3)
14
+ thor (~> 1.0)
15
+ clap (1.0.0)
16
+ diff-lcs (1.4.4)
17
+ rake (13.0.3)
18
+ rspec (3.10.0)
19
+ rspec-core (~> 3.10.0)
20
+ rspec-expectations (~> 3.10.0)
21
+ rspec-mocks (~> 3.10.0)
22
+ rspec-core (3.10.1)
23
+ rspec-support (~> 3.10.0)
24
+ rspec-expectations (3.10.1)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.10.0)
27
+ rspec-mocks (3.10.2)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.10.0)
30
+ rspec-support (3.10.2)
31
+ terminal-table (3.0.0)
32
+ unicode-display_width (~> 1.1, >= 1.1.1)
33
+ thor (1.1.0)
34
+ unicode-display_width (1.7.0)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ bundler (>= 1.1)
41
+ rake (~> 13.0)
42
+ rspec (~> 3.0)
43
+ security_report!
44
+
45
+ BUNDLED WITH
46
+ 2.2.5
File without changes
@@ -1,38 +1,6 @@
1
1
  require 'security_report/version'
2
2
  require 'security_report/database'
3
- require 'security_report/scanner'
4
- require 'security_report/grouped_result'
3
+ require 'security_report/auditor'
5
4
 
6
5
  module SecurityReport
7
- class Auditor
8
- def self.audit(directories)
9
- auditor = new
10
-
11
- directories.each do |directory|
12
- auditor.check(directory)
13
- end
14
-
15
- auditor
16
- end
17
-
18
- attr_reader :skipped
19
-
20
- def initialize
21
- @results = []
22
- @skipped = []
23
- @scanner = Scanner.new
24
- end
25
-
26
- def check(directory)
27
- @results.concat(@scanner.scan(directory))
28
- rescue Errno::ENOENT
29
- @skipped.push(directory)
30
- end
31
-
32
- def results
33
- @results.group_by(&:identifier).map do |_, results|
34
- GroupedResult.new(results)
35
- end
36
- end
37
- end
38
6
  end
@@ -0,0 +1,36 @@
1
+ require 'security_report/scanner'
2
+ require 'security_report/grouped_result'
3
+
4
+ module SecurityReport
5
+ class Auditor
6
+ def self.audit(directories)
7
+ auditor = self.new
8
+
9
+ directories.each do |directory|
10
+ auditor.check(directory)
11
+ end
12
+
13
+ auditor
14
+ end
15
+
16
+ attr_reader :skipped
17
+
18
+ def initialize
19
+ @results = []
20
+ @skipped = []
21
+ @scanner = Scanner.new
22
+ end
23
+
24
+ def check(directory)
25
+ @results.concat(@scanner.scan(directory))
26
+ rescue Errno::ENOENT, Bundler::GemfileLockNotFound
27
+ @skipped.push(directory)
28
+ end
29
+
30
+ def results
31
+ @results.group_by(&:identifier).map do |_, results|
32
+ GroupedResult.new(results)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -5,7 +5,7 @@ module SecurityReport
5
5
  attr_accessor :format
6
6
 
7
7
  def initialize
8
- @format = "plain"
8
+ @format = 'plain'
9
9
  end
10
10
 
11
11
  def help
@@ -24,10 +24,10 @@ module SecurityReport
24
24
 
25
25
  def reporter
26
26
  case format
27
- when "plain"
27
+ when 'plain'
28
28
  require 'security_report/plain_reporter'
29
29
  @reporter = PlainReporter.new
30
- when "table"
30
+ when 'table'
31
31
  require 'security_report/table_reporter'
32
32
  @reporter = TableReporter.new
33
33
  else
@@ -38,7 +38,7 @@ module SecurityReport
38
38
 
39
39
  def update
40
40
  return if Database.update
41
- puts "Failed updating database!"
41
+ puts 'Failed updating database!'
42
42
  exit 1
43
43
  end
44
44
 
@@ -22,7 +22,7 @@ module SecurityReport
22
22
 
23
23
  def criticality
24
24
  criticalities = @results.map(&:criticality).uniq
25
- return :high if criticalities.include? :high
25
+ return :high if criticalities.include? :high
26
26
  return :medium if criticalities.include? :medium
27
27
  :low
28
28
  end
@@ -13,7 +13,7 @@ module SecurityReport
13
13
  end
14
14
 
15
15
  def solution
16
- "Use a secure URI"
16
+ "Use a secure URI (https)"
17
17
  end
18
18
 
19
19
  def criticality
@@ -21,7 +21,7 @@ module SecurityReport
21
21
  end
22
22
 
23
23
  def self.matches?(obj)
24
- obj.instance_of? ::Bundler::Audit::Scanner::InsecureSource
24
+ obj.instance_of? ::Bundler::Audit::Results::InsecureSource
25
25
  end
26
26
  end
27
27
  end
@@ -5,9 +5,9 @@ module SecurityReport
5
5
  high, medium_or_lower = results.partition { |result| result.criticality == :high }
6
6
  medium, low_or_unknown = medium_or_lower.partition { |result| result.criticality == :medium }
7
7
 
8
- puts format_results(high) if high.any?
9
- puts format_results(medium) if medium.any?
10
- puts format_results(low_or_unknown) if low_or_unknown.any?
8
+ [high, medium, low_or_unknown].each do |results|
9
+ puts format_results(results) if results.any?
10
+ end
11
11
  else
12
12
  puts "No vulnerabilities found"
13
13
  end
@@ -23,10 +23,13 @@ module SecurityReport
23
23
  def format_results(results)
24
24
  results.map do |result|
25
25
  <<~HELPTEXT
26
- # #{result.identifier}"
27
- Projects: #{result.targets.join(", ")}"
28
- Criticality: #{result.criticality}"
29
- Solution: #{result.solution}"
26
+
27
+ # #{result.identifier}
28
+
29
+ Projects: #{result.targets.join(", ")}
30
+ Criticality: #{result.criticality}
31
+ Solution: #{result.solution}
32
+
30
33
  Problems:
31
34
  #{format_problems(result.problems)}
32
35
  HELPTEXT
@@ -35,7 +38,7 @@ module SecurityReport
35
38
 
36
39
  def format_problems(problems)
37
40
  problems.map do |problem|
38
- "* #{problem.summary}"
41
+ " * #{problem.summary}"
39
42
  end.join("\n")
40
43
  end
41
44
  end
@@ -13,7 +13,7 @@ module SecurityReport
13
13
  private
14
14
 
15
15
  def truncate(string, max)
16
- string.length > max ? "#{string[0...max].strip}..." : string
16
+ string.length > max ? "#{string[0 ... max - 3].strip}..." : string
17
17
  end
18
18
  end
19
19
  end
@@ -17,7 +17,7 @@ module SecurityReport
17
17
 
18
18
  private
19
19
 
20
- # This is a weird workaround, for methods that
20
+ # This is a weird workaround for methods that
21
21
  # require a Gemfile in the current directory
22
22
  def with_gemfile
23
23
  if File.exist? 'Gemfile'
@@ -29,7 +29,7 @@ module SecurityReport
29
29
  end
30
30
 
31
31
  def self.matches?(obj)
32
- obj.instance_of? ::Bundler::Audit::Scanner::UnpatchedGem
32
+ obj.instance_of? ::Bundler::Audit::Results::UnpatchedGem
33
33
  end
34
34
 
35
35
  private
@@ -38,7 +38,8 @@ module SecurityReport
38
38
 
39
39
  def problem_id
40
40
  if advisory.cve
41
- "CVE-#{advisory.cve}"
41
+ #"CVE-#{advisory.cve}"
42
+ "https://cve.circl.lu/cve/CVE-#{advisory.cve}"
42
43
  elsif advisory.osvdb
43
44
  advisory.osvdb
44
45
  end
@@ -1,3 +1,3 @@
1
1
  module SecurityReport
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.1.2".freeze
3
3
  end
@@ -1,31 +1,31 @@
1
- lib = File.expand_path("lib", __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "security_report/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "security_report"
7
- spec.version = SecurityReport::VERSION
8
- spec.authors = ["Lucas Dohmen"]
9
- spec.email = ["lucas.dohmen@innoq.com"]
10
- spec.license = "Apache-2.0"
11
-
12
- spec.summary = "Generate a security report"
13
- spec.description = "Check Ruby projects for dependencies with known security problems"
14
-
15
- # Specify which files should be added to the gem when it is released.
16
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
19
- end
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
-
24
- spec.add_dependency "bundler-audit", "~> 0.6"
25
- spec.add_dependency "clap", "~> 1.0"
26
- spec.add_dependency "terminal-table", "~> 1.8"
27
-
28
- spec.add_development_dependency "bundler", "~> 1.16"
29
- spec.add_development_dependency "rake", "~> 12.3"
30
- spec.add_development_dependency "rspec", "~> 3.0"
31
- end
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "security_report/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "security_report"
7
+ spec.version = SecurityReport::VERSION
8
+ spec.authors = ["Lucas Dohmen", "Willem van Kerkhof"]
9
+ spec.email = ["lucas.dohmen@innoq.com", "wvk@innoq.com"]
10
+ spec.license = "Apache-2.0"
11
+
12
+ spec.summary = "Generate a security report"
13
+ spec.description = "Check Ruby projects for dependencies with known security problems"
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
19
+ end
20
+ spec.bindir = "bin"
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "bundler-audit", "~> 0.8"
25
+ spec.add_dependency "clap", "~> 1.0"
26
+ spec.add_dependency "terminal-table", "~> 3.0"
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.1"
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
+ spec.add_development_dependency "rspec", "~> 3.0"
31
+ end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: security_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Dohmen
8
+ - Willem van Kerkhof
8
9
  autorequire:
9
- bindir: exe
10
+ bindir: bin
10
11
  cert_chain: []
11
- date: 2018-08-16 00:00:00.000000000 Z
12
+ date: 2021-03-15 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler-audit
@@ -16,14 +17,14 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '0.6'
20
+ version: '0.8'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '0.6'
27
+ version: '0.8'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: clap
29
30
  requirement: !ruby/object:Gem::Requirement
@@ -44,42 +45,42 @@ dependencies:
44
45
  requirements:
45
46
  - - "~>"
46
47
  - !ruby/object:Gem::Version
47
- version: '1.8'
48
+ version: '3.0'
48
49
  type: :runtime
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
53
  - - "~>"
53
54
  - !ruby/object:Gem::Version
54
- version: '1.8'
55
+ version: '3.0'
55
56
  - !ruby/object:Gem::Dependency
56
57
  name: bundler
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
60
  - - "~>"
60
61
  - !ruby/object:Gem::Version
61
- version: '1.16'
62
+ version: '1.1'
62
63
  type: :development
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
67
  - - "~>"
67
68
  - !ruby/object:Gem::Version
68
- version: '1.16'
69
+ version: '1.1'
69
70
  - !ruby/object:Gem::Dependency
70
71
  name: rake
71
72
  requirement: !ruby/object:Gem::Requirement
72
73
  requirements:
73
74
  - - "~>"
74
75
  - !ruby/object:Gem::Version
75
- version: '12.3'
76
+ version: '13.0'
76
77
  type: :development
77
78
  prerelease: false
78
79
  version_requirements: !ruby/object:Gem::Requirement
79
80
  requirements:
80
81
  - - "~>"
81
82
  - !ruby/object:Gem::Version
82
- version: '12.3'
83
+ version: '13.0'
83
84
  - !ruby/object:Gem::Dependency
84
85
  name: rspec
85
86
  requirement: !ruby/object:Gem::Requirement
@@ -97,6 +98,7 @@ dependencies:
97
98
  description: Check Ruby projects for dependencies with known security problems
98
99
  email:
99
100
  - lucas.dohmen@innoq.com
101
+ - wvk@innoq.com
100
102
  executables:
101
103
  - security_report
102
104
  extensions: []
@@ -110,8 +112,9 @@ files:
110
112
  - LICENSE
111
113
  - README.md
112
114
  - Rakefile
113
- - exe/security_report
115
+ - bin/security_report
114
116
  - lib/security_report.rb
117
+ - lib/security_report/auditor.rb
115
118
  - lib/security_report/cli.rb
116
119
  - lib/security_report/database.rb
117
120
  - lib/security_report/grouped_result.rb
@@ -142,8 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
145
  - !ruby/object:Gem::Version
143
146
  version: '0'
144
147
  requirements: []
145
- rubyforge_project:
146
- rubygems_version: 2.6.14.1
148
+ rubygems_version: 3.2.5
147
149
  signing_key:
148
150
  specification_version: 4
149
151
  summary: Generate a security report