gems-validator 0.5.0 → 0.5.3
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/lib/gems-validator/audit-service.rb +10 -7
- data/lib/gems-validator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecbe8b8affbecf34d425806340d9398bb2759c99bcbb9971d90e22d0a5cd5d7a
|
4
|
+
data.tar.gz: 730cc89f767d8c79ca3161c539d8b694c1af6f0fd007a4aba48572b7e82e6710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38642871a6867ca6cd5c2e31bd3f84656bf1f670119b0b054e7d806e1da67469db6ecf77c75e1a48953aee89c65c136f2573171301085744bf5fa1b5bb9d5a23
|
7
|
+
data.tar.gz: 75a672e7e0645e7a5a623063701e407fb71e9a1120599581104e028d06b2c2437c5a8d85a751ecc46e71b29c38410cfe1029ff85fdba72f0803557431f722dc4
|
@@ -10,18 +10,21 @@ module GemsValidator
|
|
10
10
|
|
11
11
|
def is_a_vulnerable_gem?(gem_name)
|
12
12
|
gem_vulnerabilities = @read_file["results"].select { |item| item["gem"]["name"] == gem_name }
|
13
|
-
|
13
|
+
unless gem_vulnerabilities.empty?
|
14
|
+
generate_messages(gem_vulnerabilities)
|
15
|
+
end
|
14
16
|
end
|
15
17
|
|
16
18
|
private
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
def get_translate_criticality(criticality)
|
20
|
+
translate_default_criticalities = { "critical" => "crítica", "high" => "alta", "medium" => "média", "low" => "baixa" }
|
21
|
+
translate_default_criticalities[criticality] || 'não definido'
|
22
|
+
end
|
21
23
|
|
22
|
-
|
24
|
+
def generate_messages(gem_vulnerabilities)
|
25
|
+
GemsValidator::OutputMessage.warn("A gem #{gem_vulnerabilities[0]["gem"]["name"]} na versao #{gem_vulnerabilities[0]["gem"]["version"]} apresenta #{gem_vulnerabilities.size} vulnerabilidade#{gem_vulnerabilities.size > 1 ? "s" : ""}")
|
23
26
|
gem_vulnerabilities.map.with_index do |vulnerability, number|
|
24
|
-
GemsValidator::OutputMessage.warn("
|
27
|
+
GemsValidator::OutputMessage.warn("* Título: #{vulnerability["advisory"]["title"]} \n Nível: #{get_translate_criticality(vulnerability["advisory"]["criticality"])} \n URL: #{vulnerability["advisory"]["url"]}")
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|