dependagrab 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGE_LOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/bin/dependagrab +4 -0
- data/lib/dependagrab/cli.rb +2 -19
- data/lib/dependagrab/file_writer.rb +4 -2
- data/lib/dependagrab/version.rb +1 -1
- data/lib/dependagrab.rb +26 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5571861c796d4c513f1e881285ae3d4fab353067bbaed3ff29e7b20373073bbb
|
4
|
+
data.tar.gz: 52868e44912d13efcf51b653a93fff2bcbf9f0c57b7e6397b7536f8f4856338f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9a9a6bafc2df8a2f23cf45b8f3fd9aa7b5e166da1149434fa08b48a0bf9935acff636c15d40496507aa78d13e4538e0e9a4123a23a037bb64994ab9d93c59db
|
7
|
+
data.tar.gz: f9b483d0fcba971dfb2dacc154058d25b07a6e27ddafc31f5731f2baeee1f2d7a41c3be3c7cfec8b225f91dd3b0ad52070c1a742f625f8cefb62586428ace35d
|
data/CHANGE_LOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/bin/dependagrab
CHANGED
@@ -5,7 +5,11 @@ begin
|
|
5
5
|
Dependagrab::CLI.start
|
6
6
|
rescue SignalException => e
|
7
7
|
# exit
|
8
|
+
rescue SystemExit => e
|
9
|
+
# exit
|
8
10
|
rescue Exception => e
|
9
11
|
STDERR.puts "Error: Something went wrong (set DEBUG=true for detailed backtrace)"
|
12
|
+
|
13
|
+
STDERR.puts e.message if ENV['DEBUG']
|
10
14
|
STDERR.puts e.backtrace if ENV['DEBUG']
|
11
15
|
end
|
data/lib/dependagrab/cli.rb
CHANGED
@@ -46,7 +46,8 @@ module Dependagrab
|
|
46
46
|
end
|
47
47
|
|
48
48
|
begin
|
49
|
-
|
49
|
+
options.merge!(print: true)
|
50
|
+
Dependagrab.run(options)
|
50
51
|
rescue => e
|
51
52
|
STDERR.puts "Error: #{e.message} (set DEBUG=true for detailed backtrace)"
|
52
53
|
STDERR.puts e.backtrace if ENV['DEBUG']
|
@@ -56,24 +57,6 @@ module Dependagrab
|
|
56
57
|
|
57
58
|
private
|
58
59
|
|
59
|
-
def self.run(options)
|
60
|
-
result = Dependagrab::GithubClient.new(options).grab
|
61
|
-
|
62
|
-
if options[:output]
|
63
|
-
begin
|
64
|
-
FileWriter.new(options[:output]).write!(result[:alerts])
|
65
|
-
puts "#{result[:alerts].count} dependency warnings written to '#{options.fetch(:output)}'"
|
66
|
-
rescue => e
|
67
|
-
STDERR.puts "Failed to write file '#{options.fetch(:output)}'"
|
68
|
-
STDERR.puts "Error: #{e.message} (set DEBUG=true for detailed backtrace)"
|
69
|
-
STDERR.puts e.backtrace if ENV['DEBUG']
|
70
|
-
exit 1
|
71
|
-
end
|
72
|
-
else
|
73
|
-
ConsoleWriter.new.write!(result[:alerts])
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
60
|
def self.print_usage
|
78
61
|
puts "Usage: dependagrab <REPO> [Options]"
|
79
62
|
puts
|
@@ -25,6 +25,8 @@ module Dependagrab
|
|
25
25
|
File.open(output_file, "w") do |f|
|
26
26
|
f.write(scan.to_json)
|
27
27
|
end
|
28
|
+
|
29
|
+
output_file
|
28
30
|
end
|
29
31
|
|
30
32
|
|
@@ -35,7 +37,7 @@ module Dependagrab
|
|
35
37
|
id: SecureRandom.uuid,
|
36
38
|
created: Time.now.strftime('%Y-%m-%dT%H:%M:%SZ'),
|
37
39
|
exported: Time.now.strftime('%Y-%m-%dT%H:%M:%SZ'),
|
38
|
-
source: "
|
40
|
+
source: "DependAGrab",
|
39
41
|
collectionType: "DEPENDENCY",
|
40
42
|
findings: [],
|
41
43
|
}
|
@@ -49,7 +51,7 @@ module Dependagrab
|
|
49
51
|
severity: alert[:severity].gsub("MODERATE", "MEDIUM"),
|
50
52
|
nativeSeverity: alert[:severity].gsub("MODERATE", "MEDIUM"),
|
51
53
|
summary: alert[:summary],
|
52
|
-
cvsScore: alert[:cvss],
|
54
|
+
cvsScore: alert[:cvss].to_s,
|
53
55
|
description: alert[:description],
|
54
56
|
dependencyDetails: {
|
55
57
|
library: alert[:package_name],
|
data/lib/dependagrab/version.rb
CHANGED
data/lib/dependagrab.rb
CHANGED
@@ -8,4 +8,30 @@ module Dependagrab
|
|
8
8
|
class Error < StandardError; end
|
9
9
|
class MissingConfigError < Dependagrab::Error; end
|
10
10
|
class GhApiError < Dependagrab::Error; end
|
11
|
+
|
12
|
+
|
13
|
+
def self.run(options)
|
14
|
+
result = Dependagrab::GithubClient.new(options).grab
|
15
|
+
|
16
|
+
if options[:output]
|
17
|
+
begin
|
18
|
+
output_file = FileWriter.new(options[:output]).write!(result[:alerts])
|
19
|
+
if options[:print]
|
20
|
+
puts "#{result[:alerts].count} dependency warnings written to '#{options.fetch(:output)}'"
|
21
|
+
end
|
22
|
+
output_file
|
23
|
+
rescue => e
|
24
|
+
STDERR.puts "Failed to write file '#{options.fetch(:output)}'"
|
25
|
+
STDERR.puts "Error: #{e.message} (set DEBUG=true for detailed backtrace)"
|
26
|
+
STDERR.puts e.backtrace if ENV['DEBUG']
|
27
|
+
exit 1
|
28
|
+
end
|
29
|
+
else
|
30
|
+
if options[:print]
|
31
|
+
ConsoleWriter.new.write!(result[:alerts])
|
32
|
+
else
|
33
|
+
result[:alerts]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
11
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependagrab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Elliott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql-client
|