mrjoy-bundler-audit 0.2.1 → 0.3.1

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
2
  SHA1:
3
- metadata.gz: 86bf3607b18010fe5a5a8eea50c278a4972fa133
4
- data.tar.gz: bc8390e22500c5f02f45d19f0cfa541d3f1a86bc
3
+ metadata.gz: 797e11ab94369f9ca56d1ebec7b486b739ef76a0
4
+ data.tar.gz: f86b4d43b7bc27285b9da49494d7f9bcb6d3da2d
5
5
  SHA512:
6
- metadata.gz: abaf90aff0656335877ef86c57058dfbeef7edfc35f2a961531673d2e096f82e3072eba07de2a32bd48e8eb8c1c45d90cb80ce26824e9c787f6df54fcc85d768
7
- data.tar.gz: 2a44ca737667dbbbf86435c1a84999ac36f6ad8c45d5c3cdd958d6cba889e678f3fe63aed0bf54d699eb88b8ba0686455497cf0923dc401e5da3fc186ecddb3c
6
+ metadata.gz: ecbadf97664bc14844269e91b523feb2bf17dfd569af3621a8a015b40c4c7e5b69bad171497bb950616df115f0c8fd752dda12e8551c5c8caea3571b8e100d08
7
+ data.tar.gz: 39df3b13657c0069d7739b600dc8c1feac26a51fe790438b3284d46d32a8f9a6dd2b31d9ad05e1edaed20d948d44835d0e0763b7ca0b05737eb0a7cf20ce1465
data/ChangeLog.md CHANGED
@@ -1,3 +1,22 @@
1
+ ### mrjoy-0.3.1 / 2013-11-04
2
+
3
+ * Integrated upstream 0.3.0 changes.
4
+ * Refresh built-in dataset.
5
+ * Make regression test more resilient and more bulletproof.
6
+ * Integrate grosser's mechanism for [DRYing up tests a bit](https://github.com/grosser/bundler-audit/commit/8568f936fe86eb92c95d63ef3c0a33bffd3aeee9).
7
+
8
+ ### 0.3.0 / 2013-10-31
9
+
10
+ * Added {Bundler::Audit::Database.update!} which uses `git` to download
11
+ [ruby-advisory-db] to `~/.local/share/ruby-advisory-db`.
12
+ * {Bundler::Audit::Database.path} now returns the path to either
13
+ `~/.local/share/ruby-advisory-db` or the vendored copy, depending on which
14
+ is more recent.
15
+
16
+ #### CLI
17
+
18
+ * Added the `bundle-audit update` sub-command.
19
+
1
20
  ### mrjoy-0.2.1 / 2013-09-13
2
21
 
3
22
  * Integrate upstream changes from 0.2.0, with local changes from 0.1.4.
@@ -10,10 +29,10 @@
10
29
  * Require RubyGems >= 1.8.0. Prior versions of RubyGems could not correctly
11
30
  parse approximate version requirements (`~> 1.2.3`).
12
31
  * Updated the [ruby-advisory-db].
13
- * Added {Bundle::Audit::Advisory#unaffected_versions}.
14
- * Added {Bundle::Audit::Advisory#unaffected?}.
15
- * Added {Bundle::Audit::Advisory#patched?}.
16
- * Renamed `Advisory#cve` to {Bundle::Audit::Advisory#id}.
32
+ * Added {Bundler::Audit::Advisory#unaffected_versions}.
33
+ * Added {Bundler::Audit::Advisory#unaffected?}.
34
+ * Added {Bundler::Audit::Advisory#patched?}.
35
+ * Renamed `Advisory#cve` to {Bundler::Audit::Advisory#id}.
17
36
 
18
37
  ### mrjoy-0.1.4 / 2013-08-15
19
38
 
data/README.md CHANGED
@@ -82,6 +82,32 @@ Audit a projects `Gemfile.lock`:
82
82
 
83
83
  Unpatched versions found!
84
84
 
85
+ Update the [ruby-advisory-db] that `bundle-audit` uses:
86
+
87
+ $ bundle-audit update
88
+ Updating ruby-advisory-db ...
89
+ remote: Counting objects: 44, done.
90
+ remote: Compressing objects: 100% (24/24), done.
91
+ remote: Total 39 (delta 19), reused 29 (delta 10)
92
+ Unpacking objects: 100% (39/39), done.
93
+ From https://github.com/rubysec/ruby-advisory-db
94
+ * branch master -> FETCH_HEAD
95
+ Updating 5f8225e..328ca86
96
+ Fast-forward
97
+ CONTRIBUTORS.md | 1 +
98
+ gems/actionmailer/OSVDB-98629.yml | 17 +++++++++++++++++
99
+ gems/cocaine/OSVDB-98835.yml | 15 +++++++++++++++
100
+ gems/fog-dragonfly/OSVDB-96798.yml | 13 +++++++++++++
101
+ gems/sounder/OSVDB-96278.yml | 13 +++++++++++++
102
+ gems/wicked/OSVDB-98270.yml | 14 ++++++++++++++
103
+ 6 files changed, 73 insertions(+)
104
+ create mode 100644 gems/actionmailer/OSVDB-98629.yml
105
+ create mode 100644 gems/cocaine/OSVDB-98835.yml
106
+ create mode 100644 gems/fog-dragonfly/OSVDB-96798.yml
107
+ create mode 100644 gems/sounder/OSVDB-96278.yml
108
+ create mode 100644 gems/wicked/OSVDB-98270.yml
109
+ ruby-advisory-db: 64 advisories
110
+
85
111
  ## Requirements
86
112
 
87
113
  * [bundler] ~> 1.2
@@ -97,6 +123,12 @@ Or in your Gemfile:
97
123
  gem 'mrjoy-bundler-audit', :require => nil
98
124
  ```
99
125
 
126
+ Or in your Gemfile:
127
+
128
+ ```ruby
129
+ gem 'bundler-audit', :require => nil
130
+ ```
131
+
100
132
  ## License
101
133
 
102
134
  Copyright (c) 2013 Hal Brodigan (postmodern.mod3 at gmail.com)
data/Rakefile CHANGED
@@ -23,13 +23,16 @@ require 'rake'
23
23
  require 'rubygems/tasks'
24
24
  Gem::Tasks.new
25
25
 
26
- desc 'Updates data/ruby-advisory-db'
27
- task :update do
28
- chdir 'data/ruby-advisory-db' do
29
- sh 'git', 'pull', 'origin', 'master'
30
- end
26
+ namespace :db do
27
+ desc 'Updates data/ruby-advisory-db'
28
+ task :update do
29
+ chdir 'data/ruby-advisory-db' do
30
+ sh 'git', 'pull', 'origin', 'master'
31
+ end
31
32
 
32
- sh 'git', 'commit', 'data/ruby-advisory-db', '-m', 'Updated ruby-advisory-db'
33
+ sh 'git', 'commit', 'data/ruby-advisory-db',
34
+ '-m', 'Updated ruby-advisory-db'
35
+ end
33
36
  end
34
37
 
35
38
  require 'rspec/core/rake_task'
@@ -41,14 +44,12 @@ namespace :spec do
41
44
 
42
45
  %w[secure unpatched_gems insecure_sources].each do |bundle|
43
46
  chdir(File.join(root,bundle)) do
44
- # rm_f "Gemfile.lock" if(File.exist?("Gemfile.lock"))
45
47
  begin
46
48
  sh 'BUNDLE_BIN_PATH="" BUNDLE_GEMFILE="" RUBYOPT="" bundle install --path ../../../vendor/bundle'
47
49
  rescue
48
- if(File.exist?("Gemfile.lock"))
49
- puts "Looks like Gemfile may have been updated. Attempting to update things."
50
- sh 'BUNDLE_BIN_PATH="" BUNDLE_GEMFILE="" RUBYOPT="" bundle update'
51
- end
50
+ exit(1) if(!File.exist?('Gemfile.lock'))
51
+ puts "Looks like Gemfile may have been updated. Attempting to update things."
52
+ sh 'BUNDLE_BIN_PATH="" BUNDLE_GEMFILE="" RUBYOPT="" bundle update'
52
53
  end
53
54
  end
54
55
  end
@@ -0,0 +1 @@
1
+ Gemfile.lock
@@ -11,3 +11,4 @@ Thanks,
11
11
  * [Oliver Legg](https://github.com/olly)
12
12
  * [Larry W. Cashdollar](http://vapid.dhs.org/)
13
13
  * [Michael Grosser](https://github.com/grosser)
14
+ * [Sascha Korth](https://github.com/skorth)
@@ -14,15 +14,12 @@ The Ruby Advisory Database aims to compile all advisories that are relevant to R
14
14
  The database is a list of directories that match the names of Ruby libraries on
15
15
  [rubygems.org]. Within each directory are one or more advisory files
16
16
  for the Ruby library. These advisory files are typically named using
17
- the advisories [CVE] identifier number.
17
+ the advisories [OSVDB] identifier number.
18
18
 
19
19
  gems/:
20
20
  actionpack/:
21
- CVE-2012-1099.yml CVE-2012-3463.yml CVE-2013-0156.yml
22
- CVE-2013-1857.yml CVE-2012-3424.yml CVE-2012-3465.yml
23
- CVE-2013-1855.yml
24
-
25
- If an advisory does not yet have a [CVE], [requesting a CVE][1] is easy.
21
+ OSVDB-79727.yml OSVDB-84513.yml OSVDB-89026.yml OSVDB-91454.yml
22
+ OSVDB-84243.yml OSVDB-84515.yml OSVDB-91452.yml
26
23
 
27
24
  ## Format
28
25
 
@@ -78,9 +75,8 @@ developed by the Open Security Foundation (OSF) and its contributors.
78
75
 
79
76
  [rubygems.org]: https://rubygems.org/
80
77
  [CVE]: http://cve.mitre.org/
78
+ [OSVDB]: http://www.osvdb.org/
81
79
  [CVSSv2]: http://www.first.org/cvss/cvss-guide.html
82
80
  [OSVDB]: http://www.osvdb.org/
83
81
  [YAML]: http://www.yaml.org/
84
82
  [CONTRIBUTORS.md]: https://github.com/rubysec/ruby-advisory-db/blob/master/CONTRIBUTORS.md
85
-
86
- [1]: http://people.redhat.com/kseifrie/CVE-OpenSource-Request-HOWTO.html
@@ -0,0 +1,17 @@
1
+ ---
2
+ gem: actionmailer
3
+ cve: 2013-4389
4
+ osvdb: 98629
5
+ url: http://www.osvdb.org/show/osvdb/98629
6
+ title: Action Mailer Gem for Ruby contains a possible DoS Vulnerability
7
+ date: 2013-10-16
8
+ description: Action Mailer Gem for Ruby contains a format string flaw in
9
+ the Log Subscriber component. The issue is triggered as format string
10
+ specifiers (e.g. %s and %x) are not properly sanitized in user-supplied
11
+ input when handling email addresses. This may allow a remote attacker
12
+ to cause a denial of service
13
+ cvss_v2: 4.3
14
+ unaffected_versions:
15
+ - ~> 2.3.2
16
+ patched_versions:
17
+ - '>= 3.2.15'
@@ -0,0 +1,15 @@
1
+ ---
2
+ gem: cocaine
3
+ cve: 2013-4457
4
+ osvdb: 98835
5
+ url: http://www.osvdb.org/show/osvdb/98835
6
+ title: Cocaine Gem for Ruby contains a flaw
7
+ date: 2013-10-22
8
+ description: Cocaine Gem for Ruby contains a flaw that is due to the method
9
+ of variable interpolation used by the program. With a specially crafted
10
+ object, a context-dependent attacker can execute arbitrary commands.
11
+ cvss_v2:
12
+ unaffected_versions:
13
+ - ~> 0.3.0
14
+ patched_versions:
15
+ - '>= 0.5.3'
@@ -0,0 +1,13 @@
1
+ ---
2
+ gem: fog-dragonfly
3
+ cve: 2013-5671
4
+ osvdb: 96798
5
+ url: http://www.osvdb.org/show/osvdb/96798
6
+ title: fog-dragonfly Gem for Ruby imagemagickutils.rb Remote Command Execution
7
+ date: 2013-09-03
8
+ description: fog-dragonfly Gem for Ruby contains a flaw that is due to the program
9
+ failing to properly sanitize input passed via the imagemagickutils.rb script. This
10
+ may allow a remote attacker to execute arbitrary commands.
11
+ cvss_v2:
12
+ patched_versions:
13
+ - ">= 0.8.4"
@@ -0,0 +1,16 @@
1
+ ---
2
+ gem: redis-namespace
3
+ osvdb: 96425
4
+ url: http://www.osvdb.org/show/osvdb/96425
5
+ title: redis-namespace Gem for Ruby contains a flaw in the method_missing implementation
6
+ date: 2013-08-03
7
+ description: |
8
+ redis-namespace Gem for Ruby contains a flaw in the method_missing implementation.
9
+ The issue is triggered when handling exec commands called via send(). This may allow a
10
+ remote attacker to execute arbitrary commands.
11
+ cvss_v2:
12
+ patched_versions:
13
+ - ">= 1.3.1"
14
+ - ">= 1.2.2"
15
+ - ">= 1.1.1"
16
+ - ">= 1.0.4"
@@ -0,0 +1,13 @@
1
+ ---
2
+ gem: sounder
3
+ cve: 2013-5647
4
+ osvdb: 96278
5
+ url: http://www.osvdb.org/show/osvdb/96278
6
+ title: Sounder Gem for Ruby File Name Handling Arbitrary Command Execution
7
+ date: 2013-08-14
8
+ description: Sounder Gem for Ruby contains a flaw that is triggered during the handling
9
+ of file names. This may allow a context-dependent attacker to execute arbitrary
10
+ commands.
11
+ cvss_v2: 7.5
12
+ patched_versions:
13
+ - '>= 1.0.2'
@@ -0,0 +1,14 @@
1
+ ---
2
+ gem: wicked
3
+ cve: 2013-4413
4
+ osvdb: 98270
5
+ url: http://www.osvdb.org/show/osvdb/98270
6
+ title: Wicked Gem for Ruby contains a flaw
7
+ date: 2013-10-08
8
+ description: Wicked Gem for Ruby contains a flaw that is due to the program
9
+ failing to properly sanitize input passed via the 'the_step' parameter
10
+ upon submission to the render_redirect.rb script.
11
+ This may allow a remote attacker to gain access to arbitrary files.
12
+ cvss_v2:
13
+ patched_versions:
14
+ - '>= 1.0.1'
@@ -84,7 +84,7 @@ module Bundler
84
84
  # Checks whether the version is not affected by the advisory.
85
85
  #
86
86
  # @param [Gem::Version] version
87
- # The version to compare against {#unaffected_version}.
87
+ # The version to compare against {#unaffected_versions}.
88
88
  #
89
89
  # @return [Boolean]
90
90
  # Specifies whether the version is not affected by the advisory.
@@ -101,7 +101,7 @@ module Bundler
101
101
  # Checks whether the version is patched against the advisory.
102
102
  #
103
103
  # @param [Gem::Version] version
104
- # The version to compare against {#patched_version}.
104
+ # The version to compare against {#patched_versions}.
105
105
  #
106
106
  # @return [Boolean]
107
107
  # Specifies whether the version is patched against the advisory.
@@ -57,6 +57,14 @@ module Bundler
57
57
  end
58
58
  end
59
59
 
60
+ desc 'update', 'Updates the ruby-advisory-db'
61
+ def update
62
+ say "Updating ruby-advisory-db ..."
63
+
64
+ Database.update!
65
+ puts "ruby-advisory-db: #{Database.new.size} advisories"
66
+ end
67
+
60
68
  desc 'version', 'Prints the bundler-audit version'
61
69
  def version
62
70
  database = Database.new
@@ -19,6 +19,7 @@
19
19
 
20
20
  require 'bundler/audit/advisory'
21
21
 
22
+ require 'time'
22
23
  require 'yaml'
23
24
 
24
25
  module Bundler
@@ -29,8 +30,14 @@ module Bundler
29
30
  #
30
31
  class Database
31
32
 
32
- # directory containing advisories
33
- PATH = File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','data','ruby-advisory-db','gems'))
33
+ # Git URL of the ruby-advisory-db
34
+ URL = 'https://github.com/rubysec/ruby-advisory-db.git'
35
+
36
+ # Default path to the ruby-advisory-db
37
+ VENDORED_PATH = File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','data','ruby-advisory-db'))
38
+
39
+ # Path to the user's copy of the ruby-advisory-db
40
+ USER_PATH = File.join(Gem.user_home,'.local','share','ruby-advisory-db')
34
41
 
35
42
  # The path to the advisory database
36
43
  attr_reader :path
@@ -44,7 +51,7 @@ module Bundler
44
51
  # @raise [ArgumentError]
45
52
  # The path was not a directory.
46
53
  #
47
- def initialize(path=PATH)
54
+ def initialize(path=self.class.path)
48
55
  unless File.directory?(path)
49
56
  raise(ArgumentError,"#{path.dump} is not a directory")
50
57
  end
@@ -52,6 +59,46 @@ module Bundler
52
59
  @path = path
53
60
  end
54
61
 
62
+ #
63
+ # The default path for the database.
64
+ #
65
+ # @return [String]
66
+ # The path to the database directory.
67
+ #
68
+ def self.path
69
+ if File.directory?(USER_PATH)
70
+ t1 = Dir.chdir(USER_PATH) { Time.parse(`git log --pretty="%cd" -1`) }
71
+ t2 = File.ctime(VENDORED_PATH)
72
+
73
+ if t1 >= t2 then USER_PATH
74
+ else VENDORED_PATH
75
+ end
76
+ else
77
+ VENDORED_PATH
78
+ end
79
+ end
80
+
81
+ #
82
+ # Updates the ruby-advisory-db.
83
+ #
84
+ # @return [Boolean]
85
+ # Specifies whether the update was successful.
86
+ #
87
+ # @note
88
+ # Requires network access.
89
+ #
90
+ # @since 0.3.0
91
+ #
92
+ def self.update!
93
+ if File.directory?(USER_PATH)
94
+ Dir.chdir(USER_PATH) do
95
+ system 'git', 'pull', 'origin', 'master'
96
+ end
97
+ else
98
+ system 'git', 'clone', URL, USER_PATH
99
+ end
100
+ end
101
+
55
102
  #
56
103
  # Enumerates over every advisory in the database.
57
104
  #
@@ -163,7 +210,7 @@ module Bundler
163
210
  # A path to an advisory `.yml` file.
164
211
  #
165
212
  def each_advisory_path(&block)
166
- Dir.glob(File.join(@path,'*','*.yml'),&block)
213
+ Dir.glob(File.join(@path,'gems','*','*.yml'),&block)
167
214
  end
168
215
 
169
216
  #
@@ -179,7 +226,7 @@ module Bundler
179
226
  # A path to an advisory `.yml` file.
180
227
  #
181
228
  def each_advisory_path_for(name,&block)
182
- Dir.glob(File.join(@path,name,'*.yml'),&block)
229
+ Dir.glob(File.join(@path,'gems',name,'*.yml'),&block)
183
230
  end
184
231
 
185
232
  end
@@ -20,6 +20,6 @@
20
20
  module Bundler
21
21
  module Audit
22
22
  # bundler-audit version
23
- VERSION = '0.2.1'
23
+ VERSION = '0.3.1'
24
24
  end
25
25
  end
@@ -3,10 +3,10 @@ require 'bundler/audit/database'
3
3
  require 'bundler/audit/advisory'
4
4
 
5
5
  describe Bundler::Audit::Advisory do
6
- let(:root) { Bundler::Audit::Database::PATH }
6
+ let(:root) { Bundler::Audit::Database::VENDORED_PATH }
7
7
  let(:gem) { 'actionpack' }
8
8
  let(:id) { 'OSVDB-84243' }
9
- let(:path) { File.join(root,gem,"#{id}.yml") }
9
+ let(:path) { File.join(root,'gems',gem,"#{id}.yml") }
10
10
  let(:an_unaffected_version) do
11
11
  YAML.
12
12
  load(File.read(path))['unaffected_versions'].
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '3.2.14'
3
+ gem 'rails', '3.2.15'
4
4
 
5
5
  # Bundle edge Rails instead:
6
6
  # gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -3,8 +3,8 @@ require 'bundler/audit/database'
3
3
  require 'tmpdir'
4
4
 
5
5
  describe Bundler::Audit::Database do
6
- describe "PATH" do
7
- subject { described_class::PATH }
6
+ describe "path" do
7
+ subject { described_class.path }
8
8
 
9
9
  it "it should be a directory" do
10
10
  File.directory?(subject).should be_true
@@ -15,8 +15,8 @@ describe Bundler::Audit::Database do
15
15
  context "when given no arguments" do
16
16
  subject { described_class.new }
17
17
 
18
- it "should default path to PATH" do
19
- subject.path.should == described_class::PATH
18
+ it "should default path to path" do
19
+ subject.path.should == described_class.path
20
20
  end
21
21
  end
22
22
 
@@ -3,79 +3,65 @@ require 'spec_helper'
3
3
  describe "CLI" do
4
4
  include Helpers
5
5
 
6
- let(:command) do
7
- File.expand_path(File.join(File.dirname(__FILE__),'..','bin','bundle-audit'))
8
- end
6
+ let(:directory) { File.join('spec','bundle',bundle) }
9
7
 
10
- context "when auditing a bundle with unpatched gems" do
8
+ context "when auditing a vulnerable bundle" do
11
9
  let(:bundle) { 'unpatched_gems' }
12
- let(:directory) { File.join('spec','bundle',bundle) }
13
-
14
- subject do
15
- Dir.chdir(directory) { sh(command, :fail => true) }
16
- end
17
-
18
- it "should print a warning" do
19
- subject.should include("Unpatched versions found!")
20
- end
21
10
 
22
11
  it "should print advisory information for the vulnerable gems" do
12
+ output = audit_in_directory "", directory, :fail => true
13
+ # Doing this so we can get an exact count on the number of
14
+ # vulnerabilities we should match with the regex below.
15
+ vuln_count = output.split(/Name:/).length - 1 # Less one for the
16
+ # zero-width prefix before
17
+ # the first match.
18
+
19
+ # Note the "{8,}" below indicates the minimum number of advisories that
20
+ # we should see matches for -- as a particular version of code will never
23
21
  advisory_pattern = /(Name: [^\n]+
24
- Version: \d+.\d+.\d+
22
+ Version: \d+\.\d+\.\d+
25
23
  Advisory: OSVDB-\d+
26
24
  Criticality: (High|Medium)
27
- URL: http:\/\/(direct|www\.)?osvdb.org\/show\/osvdb\/\d+
28
- Title: [^\n]*?
29
- Solution: upgrade to ((~>|=>) \d+.\d+.\d+, )*(~>|=>) \d+.\d+.\d+[\s\n]*?)+/
30
-
31
- expect(subject).to match(advisory_pattern)
32
- expect(subject).to include("Unpatched versions found!")
25
+ URL: http:\/\/(direct\.|www\.)?osvdb\.org\/show\/osvdb\/\d+
26
+ Title: [^\n]+
27
+ Solution: upgrade to ((~>|=>|>=) \d+\.\d+\.\d+, )*((~>|=>|>=) \d+\.\d+\.\d+)[\s\n]*?){#{vuln_count}}/
28
+ expect(vuln_count).to be >= 8 # As of 2013-11-04, this bundle turns up 8
29
+ # vulns. That could increase over time of
30
+ # course.
31
+ expect(output).to match(advisory_pattern)
32
+ expect(output).to include("Unpatched versions found!")
33
33
  end
34
34
  end
35
35
 
36
36
  context "when auditing a bundle with ignored gems" do
37
37
  let(:bundle) { 'unpatched_gems' }
38
- let(:directory) { File.join('spec','bundle',bundle) }
39
-
40
- let(:command) do
41
- File.expand_path(File.join(File.dirname(__FILE__),'..','bin','bundle-audit -i OSVDB-89026'))
42
- end
43
-
44
- subject do
45
- Dir.chdir(directory) { sh(command, :fail => true) }
46
- end
47
38
 
48
39
  it "should not print advisory information for ignored gem" do
49
- subject.should_not include("OSVDB-89026")
40
+ output = audit_in_directory "-i OSVDB-89026", directory, :fail => true
41
+
42
+ expect(output).to_not include("OSVDB-89026")
50
43
  end
51
44
  end
52
45
 
53
46
  context "when auditing a bundle with insecure sources" do
54
47
  let(:bundle) { 'insecure_sources' }
55
- let(:directory) { File.join('spec','bundle',bundle) }
56
-
57
- subject do
58
- Dir.chdir(directory) { sh(command, :fail => true) }
59
- end
60
48
 
61
49
  it "should print warnings about insecure sources" do
62
- subject.should include(%{
50
+ output = audit_in_directory "", directory, :fail => true
51
+ expect(output).to include(%{
63
52
  Insecure Source URI found: git://github.com/rails/jquery-rails.git
64
53
  Insecure Source URI found: http://rubygems.org/
65
54
  }.strip)
66
55
  end
67
56
  end
68
57
 
58
+
69
59
  context "when auditing a secure bundle" do
70
60
  let(:bundle) { 'secure' }
71
- let(:directory) { File.join('spec','bundle',bundle) }
72
-
73
- subject do
74
- Dir.chdir(directory) { sh(command) }
75
- end
76
61
 
77
62
  it "should print nothing when everything is fine" do
78
- subject.strip.should == "No unpatched versions found"
63
+ output = audit_in_directory "", directory
64
+ expect(output.strip).to eq "No unpatched versions found"
79
65
  end
80
66
  end
81
67
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,3 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- Bundler.require
4
1
  require 'rspec'
5
2
  require 'bundler/audit/version'
6
3
 
@@ -16,6 +13,14 @@ module Helpers
16
13
  def decolorize(string)
17
14
  string.gsub(/\e\[\d+m/, "")
18
15
  end
16
+
17
+ def executable
18
+ File.expand_path(File.join('..','..','bin','bundle-audit'), __FILE__)
19
+ end
20
+
21
+ def audit_in_directory(additions, directory, options={})
22
+ Dir.chdir(directory) { decolorize(sh([executable, additions].compact.join(' '), options)) }
23
+ end
19
24
  end
20
25
 
21
26
  include Bundler::Audit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrjoy-bundler-audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-13 00:00:00.000000000 Z
12
+ date: 2013-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -66,6 +66,7 @@ files:
66
66
  - spec/integration_spec.rb
67
67
  - spec/scanner_spec.rb
68
68
  - spec/spec_helper.rb
69
+ - data/ruby-advisory-db/.gitignore
69
70
  - data/ruby-advisory-db/.rspec
70
71
  - data/ruby-advisory-db/CONTRIBUTING.md
71
72
  - data/ruby-advisory-db/CONTRIBUTORS.md
@@ -73,6 +74,7 @@ files:
73
74
  - data/ruby-advisory-db/LICENSE.txt
74
75
  - data/ruby-advisory-db/README.md
75
76
  - data/ruby-advisory-db/Rakefile
77
+ - data/ruby-advisory-db/gems/actionmailer/OSVDB-98629.yml
76
78
  - data/ruby-advisory-db/gems/actionpack/OSVDB-79727.yml
77
79
  - data/ruby-advisory-db/gems/actionpack/OSVDB-84243.yml
78
80
  - data/ruby-advisory-db/gems/actionpack/OSVDB-84513.yml
@@ -90,6 +92,7 @@ files:
90
92
  - data/ruby-advisory-db/gems/activesupport/OSVDB-84516.yml
91
93
  - data/ruby-advisory-db/gems/activesupport/OSVDB-89594.yml
92
94
  - data/ruby-advisory-db/gems/activesupport/OSVDB-91451.yml
95
+ - data/ruby-advisory-db/gems/cocaine/OSVDB-98835.yml
93
96
  - data/ruby-advisory-db/gems/command_wrap/OSVDB-91450.yml
94
97
  - data/ruby-advisory-db/gems/crack/OSVDB-90742.yml
95
98
  - data/ruby-advisory-db/gems/cremefraiche/OSVDB-93395.yml
@@ -103,6 +106,7 @@ files:
103
106
  - data/ruby-advisory-db/gems/fileutils/OSVDB-90716.yml
104
107
  - data/ruby-advisory-db/gems/fileutils/OSVDB-90717.yml
105
108
  - data/ruby-advisory-db/gems/flash_tool/OSVDB-90829.yml
109
+ - data/ruby-advisory-db/gems/fog-dragonfly/OSVDB-96798.yml
106
110
  - data/ruby-advisory-db/gems/ftpd/OSVDB-90784.yml
107
111
  - data/ruby-advisory-db/gems/gtk2/OSVDB-40774.yml
108
112
  - data/ruby-advisory-db/gems/httparty/OSVDB-90741.yml
@@ -124,13 +128,16 @@ files:
124
128
  - data/ruby-advisory-db/gems/rack-cache/OSVDB-83077.yml
125
129
  - data/ruby-advisory-db/gems/rack/OSVDB-89939.yml
126
130
  - data/ruby-advisory-db/gems/rdoc/OSVDB-90004.yml
131
+ - data/ruby-advisory-db/gems/redis-namespace/OSVDB-96425.yml
127
132
  - data/ruby-advisory-db/gems/rgpg/OSVDB-95948.yml
128
133
  - data/ruby-advisory-db/gems/ruby_parser/OSVDB-90561.yml
134
+ - data/ruby-advisory-db/gems/sounder/OSVDB-96278.yml
129
135
  - data/ruby-advisory-db/gems/spree/OSVDB-91216.yml
130
136
  - data/ruby-advisory-db/gems/spree/OSVDB-91217.yml
131
137
  - data/ruby-advisory-db/gems/spree/OSVDB-91218.yml
132
138
  - data/ruby-advisory-db/gems/spree/OSVDB-91219.yml
133
139
  - data/ruby-advisory-db/gems/thumbshooter/OSVDB-91839.yml
140
+ - data/ruby-advisory-db/gems/wicked/OSVDB-98270.yml
134
141
  - data/ruby-advisory-db/lib/scrape.rb
135
142
  - data/ruby-advisory-db/spec/advisory_example.rb
136
143
  - data/ruby-advisory-db/spec/gems_spec.rb
@@ -155,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
162
  version: 1.8.0
156
163
  requirements: []
157
164
  rubyforge_project:
158
- rubygems_version: 2.0.5
165
+ rubygems_version: 2.0.6
159
166
  signing_key:
160
167
  specification_version: 4
161
168
  summary: Patch-level verification for Bundler