gemsurance 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c97771cd0f9df54057305e210335c95a7a1d5af7
4
+ data.tar.gz: e7c390d1362b343c514b82c26c21ebdc1beaee9b
5
+ SHA512:
6
+ metadata.gz: 751373c800d73337666dab5731f3f01cba1b36e70699a76794e1c41a587a91cce2acf11569258a7bf11ed66ec79a99a1d66882a2996892f3bdca65e460cf1a44
7
+ data.tar.gz: 43ebafd468d17761670d9e5d20c2ea3d172c75ac8b5e94bf7efb9a12c1db05a05121528d0ed006439621e419b33abad3b4e4dca7716cc7416d2c22a80168efb2
@@ -40,16 +40,24 @@ module Gemsurance
40
40
  end
41
41
  end
42
42
 
43
- def add_vulnerability_data(gem_infos)
43
+ def add_vulnerability_data(gem_infos, vulnerabilities_directory = './tmp/vulnerabilities/gems')
44
44
  puts "Reading vulnerability data..."
45
45
  gem_infos.each do |gem_info|
46
- vulnerability_directory = "./tmp/vulnerabilities/gems/#{gem_info.name}"
46
+ vulnerability_directory = File.join(vulnerabilities_directory, gem_info.name)
47
47
  if File.exists?(vulnerability_directory)
48
48
  Dir.foreach(vulnerability_directory) do |yaml_file|
49
49
  next if yaml_file =~ /\A\./
50
50
  vulnerability = Vulnerability.new(File.read(File.join(vulnerability_directory, yaml_file)))
51
+
51
52
  # are we impacted? if so, add details to gem_data
52
- unless vulnerability.patched_versions.any? { |version| Gem::Requirement.new(version).satisfied_by?(gem_info.current_version) }
53
+ current_version_satisfies_requirement = lambda do |version|
54
+ Gem::Requirement.new(version.split(',')).satisfied_by?(gem_info.current_version)
55
+ end
56
+
57
+ current_version_is_affected = (vulnerability.unaffected_versions || []).none?(&current_version_satisfies_requirement)
58
+ current_version_isnt_patched = (vulnerability.patched_versions || []).none?(&current_version_satisfies_requirement)
59
+
60
+ if current_version_is_affected && current_version_isnt_patched
53
61
  gem_info.add_vulnerability!(vulnerability)
54
62
  end
55
63
  end
@@ -788,7 +788,7 @@
788
788
  <dt>URL</dt>
789
789
  <dd><a href="<%= vulnerability.url %>">More Info</a></dd>
790
790
  <dt>Patched Versions</dt>
791
- <dd><%= vulnerability.patched_versions.join(', ') %></dd>
791
+ <dd><%= (vulnerability.patched_versions || []).join(', ') %></dd>
792
792
  </dl>
793
793
  <% end %>
794
794
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Gemsurance
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -8,7 +8,7 @@ module Gemsurance
8
8
 
9
9
  attr_reader :attributes
10
10
 
11
- ATTRIBUTES = [:gem, :framework, :cve, :osvdb, :url, :title, :description, :date, :cvss_v2, :patched_versions].freeze
11
+ ATTRIBUTES = [:gem, :framework, :cve, :osvdb, :url, :title, :description, :date, :cvss_v2, :patched_versions, :unaffected_versions].freeze
12
12
 
13
13
  ATTRIBUTES.each do |attr|
14
14
  define_method(attr) do
metadata CHANGED
@@ -1,110 +1,92 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gemsurance
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Jon Kessler
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-03-14 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: bundler
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 11
29
- segments:
30
- - 1
31
- - 2
32
- version: "1.2"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
33
20
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: git
37
21
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: git
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
41
31
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 11
44
- segments:
45
- - 1
46
- - 2
47
- version: "1.2"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
48
34
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: mocha
52
35
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - "="
57
- - !ruby/object:Gem::Version
58
- hash: 39
59
- segments:
60
- - 0
61
- - 14
62
- - 0
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mocha
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
63
47
  version: 0.14.0
64
48
  type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: rake
68
49
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - "="
73
- - !ruby/object:Gem::Version
74
- hash: 11
75
- segments:
76
- - 0
77
- - 9
78
- - 2
79
- - 2
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.14.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
80
61
  version: 0.9.2.2
81
62
  type: :development
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: nokogiri
85
63
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
89
- - - "="
90
- - !ruby/object:Gem::Version
91
- hash: 17
92
- segments:
93
- - 1
94
- - 5
95
- - 9
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.2.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: nokogiri
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
96
75
  version: 1.5.9
97
76
  type: :development
98
- version_requirements: *id005
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.5.9
99
83
  description: Gem vulnerability and version checker
100
84
  email: jon.kessler@appfolio.com
101
- executables:
85
+ executables:
102
86
  - gemsurance
103
87
  extensions: []
104
-
105
88
  extra_rdoc_files: []
106
-
107
- files:
89
+ files:
108
90
  - bin/gemsurance
109
91
  - lib/gemsurance.rb
110
92
  - lib/gemsurance/gem_info_retriever.rb
@@ -114,37 +96,27 @@ files:
114
96
  - lib/gemsurance/version.rb
115
97
  - lib/gemsurance/vulnerability.rb
116
98
  homepage: http://github.com/appfolio/gemsurance
117
- licenses:
99
+ licenses:
118
100
  - MIT
101
+ metadata: {}
119
102
  post_install_message:
120
103
  rdoc_options: []
121
-
122
- require_paths:
104
+ require_paths:
123
105
  - lib
124
- required_ruby_version: !ruby/object:Gem::Requirement
125
- none: false
126
- requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
- version: "0"
133
- required_rubygems_version: !ruby/object:Gem::Requirement
134
- none: false
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- hash: 3
139
- segments:
140
- - 0
141
- version: "0"
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
142
116
  requirements: []
143
-
144
117
  rubyforge_project:
145
- rubygems_version: 1.8.25
118
+ rubygems_version: 2.1.11
146
119
  signing_key:
147
- specification_version: 3
120
+ specification_version: 4
148
121
  summary: Your Gem Insurance Policy
149
122
  test_files: []
150
-