bundler-audit 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/.gitignore +3 -0
  2. data/.gitmodules +3 -0
  3. data/.travis.yml +4 -0
  4. data/ChangeLog.md +13 -0
  5. data/Gemfile +12 -0
  6. data/README.md +3 -37
  7. data/Rakefile +20 -49
  8. data/bundler-audit.gemspec +7 -0
  9. data/data/ruby-advisory-db/.rspec +1 -0
  10. data/data/ruby-advisory-db/README.md +64 -0
  11. data/data/ruby-advisory-db/gems/actionpack/2012-1099.yml +23 -0
  12. data/data/{bundler/audit/rails → ruby-advisory-db/gems/actionpack}/2012-3424.yml +10 -6
  13. data/data/ruby-advisory-db/gems/actionpack/2012-3463.yml +20 -0
  14. data/data/ruby-advisory-db/gems/actionpack/2012-3465.yml +20 -0
  15. data/data/{bundler/audit/rails → ruby-advisory-db/gems/actionpack}/2013-0156.yml +5 -3
  16. data/data/ruby-advisory-db/gems/activerecord/2012-2660.yml +21 -0
  17. data/data/ruby-advisory-db/gems/activerecord/2012-2661.yml +19 -0
  18. data/data/{bundler/audit/rails → ruby-advisory-db/gems/activerecord}/2013-0155.yml +6 -4
  19. data/data/{bundler/audit/rails → ruby-advisory-db/gems/activerecord}/2013-0276.yml +5 -3
  20. data/data/{bundler/audit/rails → ruby-advisory-db/gems/activerecord}/2013-0277.yml +5 -3
  21. data/data/ruby-advisory-db/gems/activesupport/2012-1098.yml +20 -0
  22. data/data/ruby-advisory-db/gems/activesupport/2012-3464.yml +20 -0
  23. data/data/{bundler/audit/rails → ruby-advisory-db/gems/activesupport}/2013-0333.yml +5 -3
  24. data/data/ruby-advisory-db/gems/devise/2013-0233.yml +18 -0
  25. data/data/ruby-advisory-db/gems/gtk2/2007-6183.yml +18 -0
  26. data/data/{bundler/audit → ruby-advisory-db/gems}/json/2013-0269.yml +4 -2
  27. data/data/ruby-advisory-db/gems/mail/2011-0739.yml +19 -0
  28. data/data/ruby-advisory-db/gems/mail/2012-2139.yml +11 -0
  29. data/data/ruby-advisory-db/gems/mail/2012-2140.yml +11 -0
  30. data/data/ruby-advisory-db/gems/multi_xml/2013-0175.yml +14 -0
  31. data/data/ruby-advisory-db/gems/newrelic_rpm/2013-0284.yml +15 -0
  32. data/data/ruby-advisory-db/gems/nori/2013-0285.yml +17 -0
  33. data/data/ruby-advisory-db/gems/omniauth-oauth2/2012-6134.yml +14 -0
  34. data/data/ruby-advisory-db/gems/rack-cache/2012-267.yml +16 -0
  35. data/data/{bundler/audit → ruby-advisory-db/gems}/rack/2013-0263.yml +9 -8
  36. data/data/ruby-advisory-db/gems/rdoc/2013-0256.yml +25 -0
  37. data/data/ruby-advisory-db/spec/advisory_example.rb +80 -0
  38. data/data/ruby-advisory-db/spec/gems_spec.rb +8 -0
  39. data/data/ruby-advisory-db/spec/spec_helper.rb +1 -0
  40. data/gemspec.yml +1 -6
  41. data/lib/bundler/audit/advisory.rb +13 -1
  42. data/lib/bundler/audit/cli.rb +17 -6
  43. data/lib/bundler/audit/database.rb +1 -30
  44. data/lib/bundler/audit/version.rb +1 -1
  45. data/spec/advisory_spec.rb +1 -1
  46. data/spec/bundle/secure/Gemfile +38 -0
  47. data/spec/bundle/{Gemfile → vuln/Gemfile} +0 -0
  48. data/spec/database_spec.rb +1 -32
  49. data/spec/integration_spec.rb +63 -0
  50. data/spec/spec_helper.rb +14 -1
  51. metadata +68 -112
  52. data/data/bundler/audit/mail/2011-0739.yml +0 -17
  53. data/data/bundler/audit/mail/2012-2139.yml +0 -16
  54. data/data/bundler/audit/mail/2012-2140.yml +0 -13
  55. data/data/bundler/audit/rack-cache/2012-267.yml +0 -14
  56. data/data/bundler/audit/rails/2012-1098.yml +0 -19
  57. data/data/bundler/audit/rails/2012-1099.yml +0 -19
  58. data/data/bundler/audit/rails/2012-2660.yml +0 -17
  59. data/data/bundler/audit/rails/2012-2661.yml +0 -18
  60. data/data/bundler/audit/rails/2012-3463.yml +0 -19
  61. data/data/bundler/audit/rails/2012-3464.yml +0 -18
  62. data/data/bundler/audit/rails/2012-3465.yml +0 -19
  63. data/spec/bundle/Gemfile.lock +0 -92
data/.gitignore CHANGED
@@ -1,2 +1,5 @@
1
+ Gemfile.lock
1
2
  doc/
2
3
  pkg/
4
+ spec/bundle/*/Gemfile.lock
5
+ vendor/cache/*.gem
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "data/ruby-advisory-db"]
2
+ path = data/ruby-advisory-db
3
+ url = https://github.com/rubysec/ruby-advisory-db.git
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
data/ChangeLog.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 0.1.2 / 2013-02-17
2
+
3
+ * Require [bundler] ~> 1.2.
4
+ * Vendor a full copy of the [ruby-advisory-db].
5
+ * Added {Bundler::Audit::Advisory#path} for debugging purposes.
6
+ * Added {Bundler::Audit::Advisory#to_s} for debugging purposes.
7
+
8
+ #### CLI
9
+
10
+ * Simply parse the `Gemfile.lock` instead of loading the bundle (@grosser).
11
+ * Exit with non-zero status on failure (@grosser).
12
+
1
13
  ### 0.1.1 / 2013-02-12
2
14
 
3
15
  * Fixed a Ruby 1.8 syntax error.
@@ -40,4 +52,5 @@
40
52
  * [CVE-2013-0277](http://direct.osvdb.org/show/osvdb/90073)
41
53
  * [CVE-2013-0333](http://osvdb.org/show/osvdb/89594)
42
54
 
55
+ [bundler]: http://gembundler.com/
43
56
  [ruby-advisory-db]: https://github.com/rubysec/ruby-advisory-db#readme
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake', '~> 10.0'
7
+ gem 'kramdown', '~> 0.14'
8
+
9
+ gem 'rubygems-tasks', '~> 0.2'
10
+ gem 'rspec', '~> 2.4'
11
+ gem 'yard', '~> 0.8'
12
+ end
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  * [Issues](https://github.com/postmodern/bundler-audit/issues)
5
5
  * [Documentation](http://rubydoc.info/gems/bundler-audit/frames)
6
6
  * [Email](mailto:postmodern.mod3 at gmail.com)
7
+ * [![Build Status](https://travis-ci.org/postmodern/bundler-audit.png)](https://travis-ci.org/postmodern/bundler-audit)
8
+
7
9
 
8
10
  ## Description
9
11
 
@@ -65,48 +67,12 @@ Audit a projects `Gemfile.lock`:
65
67
 
66
68
  ## Requirements
67
69
 
68
- * [bundler] ~> 1.0
70
+ * [bundler] ~> 1.2
69
71
 
70
72
  ## Install
71
73
 
72
74
  $ gem install bundler-audit
73
75
 
74
- ## Contributing Advisories
75
-
76
- For an advisory to be added to the Database, it must match the following
77
- format:
78
-
79
- * Must be a YAML file.
80
- * Must be placed in the `data/bundler/audit/$gem/` directory.
81
- * Must be named after the CVE number (`2013-0156.yml`):
82
- * Must contain a URL to the [OSVDB] advisory.
83
- * Must contain the `title` and `description`.
84
- * Must contain the `title` and `description`.
85
- * Must contain the CVSSv2 Score.
86
- * Must contain the patched versions ranges.
87
-
88
- ### Example
89
-
90
- ---
91
- url: http://osvdb.org/show/osvdb/89026
92
- title: |
93
- Ruby on Rails params_parser.rb Action Pack Type Casting Parameter Parsing
94
- Remote Code Execution
95
-
96
- description: |
97
- Ruby on Rails contains a flaw in params_parser.rb of the Action Pack.
98
- The issue is triggered when a type casting error occurs during the parsing
99
- of parameters. This may allow a remote attacker to potentially execute
100
- arbitrary code.
101
-
102
- cvss_v2: 10.0
103
-
104
- patched_versions:
105
- - "~> 2.3.15"
106
- - "~> 3.0.19"
107
- - "~> 3.1.10"
108
- - ">= 3.2.11"
109
-
110
76
  ## License
111
77
 
112
78
  Copyright (c) 2013 Hal Brodigan (postmodern.mod3 at gmail.com)
data/Rakefile CHANGED
@@ -1,72 +1,43 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'rubygems'
4
- require 'rake'
5
4
 
6
5
  begin
7
- gem 'rubygems-tasks', '~> 0.2'
8
- require 'rubygems/tasks'
9
-
10
- Gem::Tasks.new
6
+ require 'bundler'
11
7
  rescue LoadError => e
12
8
  warn e.message
13
- warn "Run `gem install rubygems-tasks` to install Gem::Tasks."
9
+ warn "Run `gem install bundler` to install Bundler."
10
+ exit -1
14
11
  end
15
12
 
16
13
  begin
17
- gem 'rspec', '~> 2.4'
18
- require 'rspec/core/rake_task'
19
-
20
- RSpec::Core::RakeTask.new
21
- rescue LoadError => e
22
- task :spec do
23
- abort "Please run `gem install rspec` to install RSpec."
24
- end
14
+ Bundler.setup(:development)
15
+ rescue Bundler::BundlerError => e
16
+ warn e.message
17
+ warn "Run `bundle install` to install missing gems."
18
+ exit e.status_code
25
19
  end
26
20
 
27
- namespace :spec do
28
- task :validate do
29
- validate = lambda do |path,data,field,type|
30
- value = data[field]
21
+ require 'rake'
31
22
 
32
- case value
33
- when type
34
- # no-op
35
- when NilClass
36
- warn "#{path}: #{field} is missing"
37
- else
38
- warn "#{path}: expected #{field} to be #{type} but was #{value.class}"
39
- end
40
- end
23
+ require 'rubygems/tasks'
24
+ Gem::Tasks.new
41
25
 
42
- Dir.glob('data/bundler/audit/*/*.yml') do |path|
43
- begin
44
- data = YAML.load_file(path)
26
+ require 'rspec/core/rake_task'
27
+ RSpec::Core::RakeTask.new
45
28
 
46
- validate[path, data, 'url', String]
47
- validate[path, data, 'title', String]
48
- validate[path, data, 'description', String]
49
- validate[path, data, 'cvss_v2', Float]
50
- validate[path, data, 'patched_versions', Array]
51
- rescue ArgumentError => error
52
- warn "#{path}: #{error.message}"
53
- end
29
+ namespace :spec do
30
+ task :bundle do
31
+ %w[spec/bundle/vuln spec/bundle/secure].each do |path|
32
+ chdir(path) { sh 'bundle', 'install', '--quiet' }
54
33
  end
55
34
  end
56
35
  end
57
- task :spec => 'spec:validate'
36
+ task :spec => 'spec:bundle'
58
37
 
59
38
  task :test => :spec
60
39
  task :default => :spec
61
40
 
62
- begin
63
- gem 'yard', '~> 0.8'
64
- require 'yard'
65
-
66
- YARD::Rake::YardocTask.new
67
- rescue LoadError => e
68
- task :yard do
69
- abort "Please run `gem install yard` to install YARD."
70
- end
71
- end
41
+ require 'yard'
42
+ YARD::Rake::YardocTask.new
72
43
  task :doc => :yard
@@ -26,6 +26,13 @@ Gem::Specification.new do |gem|
26
26
  gem.files = `git ls-files`.split($/)
27
27
  gem.files = glob[gemspec['files']] if gemspec['files']
28
28
 
29
+ # add paths from data/ruby-advisory-db/
30
+ gem.files += Dir.chdir('data/ruby-advisory-db') do
31
+ `git ls-files`.split($/).map do |sub_path|
32
+ File.join('data','ruby-advisory-db',sub_path)
33
+ end
34
+ end
35
+
29
36
  gem.executables = gemspec.fetch('executables') do
30
37
  glob['bin/*'].map { |path| File.basename(path) }
31
38
  end
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,64 @@
1
+ # Ruby Advisory Database
2
+
3
+ The Ruby advisory database seeks to compile all advisories relevant to Ruby libraries.
4
+
5
+ ## Directory Structure
6
+
7
+ The database is a list of directories that match the names of Ruby libraries on
8
+ [rubygems.org]. Within each directory are one or more advisory files
9
+ for the Ruby library. These advisory files are typically named using
10
+ the advisories [CVE] identifier number.
11
+
12
+ gems/:
13
+ rails/:
14
+ 2012-1098.yml 2012-2660.yml 2012-2661.yml 2012-3463.yml
15
+
16
+ If an advisory does not yet have a [CVE], [requesting a CVE][1] is easy.
17
+ ## Format
18
+
19
+ Each advisory file contains the advisory information in [YAML] format:
20
+
21
+ ---
22
+ gem: rails
23
+ cve: 2013-0156
24
+ url: http://osvdb.org/show/osvdb/89026
25
+ title: |
26
+ Ruby on Rails params_parser.rb Action Pack Type Casting Parameter Parsing
27
+ Remote Code Execution
28
+
29
+ description: |
30
+ Ruby on Rails contains a flaw in params_parser.rb of the Action Pack.
31
+ The issue is triggered when a type casting error occurs during the parsing
32
+ of parameters. This may allow a remote attacker to potentially execute
33
+ arbitrary code.
34
+
35
+ cvss_v2: 10.0
36
+
37
+ patched_versions:
38
+ - ~> 2.3.15
39
+ - ~> 3.0.19
40
+ - ~> 3.1.10
41
+ - ">= 3.2.11"
42
+
43
+ ### Schema
44
+
45
+ * `gem` \[String\]: Name of the affected gem.
46
+ * `cve` \[String\]: CVE id
47
+ * `url` \[String\]: The URL to the full advisory.
48
+ * `title` \[String\]: The title of the advisory.
49
+ * `description` \[String\]: Multi-paragraph description of the vulnerability.
50
+ * `cvss_v2` \[Float\]: The [CVSSv2] score for the vulnerability.
51
+ * `patched_versions` \[Array\<String\>\]: The version requirements for the
52
+ patched versions of the Ruby library.
53
+
54
+ ## Credits
55
+
56
+ * [Postmodern](https://github.com/postmodern/)
57
+ * [Max Veytsman](https://twitter.com/mveytsman)
58
+
59
+ [rubygems.org]: https://rubygems.org/
60
+ [CVE]: http://cve.mitre.org/
61
+ [CVSSv2]: http://www.first.org/cvss/cvss-guide.html
62
+ [YAML]: http://www.yaml.org/
63
+
64
+ [1]: http://people.redhat.com/kseifrie/CVE-OpenSource-Request-HOWTO.html
@@ -0,0 +1,23 @@
1
+ ---
2
+ gem: actionpack
3
+ cve: 2012-1099
4
+ url: http://www.osvdb.org/show/osvdb/79727
5
+ title:
6
+ Ruby on Rails actionpack/lib/action_view/helpers/form_options_helper.rb
7
+ Manually Generated Select Tag Options XSS
8
+
9
+ description: |
10
+ Ruby on Rails contains a flaw that allows a remote cross-site scripting (XSS)
11
+ attack. This flaw exists because the application does not validate manually
12
+ generated 'select tag options' upon submission to
13
+ actionpack/lib/action_view/helpers/form_options_helper.rb. This may allow a
14
+ user to create a specially crafted request that would execute arbitrary
15
+ script code in a user's browser within the trust relationship between their
16
+ browser and the server.
17
+
18
+ cvss_v2: 4.3
19
+
20
+ patched_versions:
21
+ - ~> 3.0.12
22
+ - ~> 3.1.4
23
+ - ">= 3.2.2"
@@ -1,17 +1,21 @@
1
- ---
1
+ ---
2
+ gem: actionpack
3
+ cve: 2012-3424
2
4
  url: http://www.osvdb.org/show/osvdb/84243
3
- title: Ruby on Rails actionpack/lib/action_controller/metal/http_authentication.rb with_http_digest Helper Method Remote DoS
5
+ title:
6
+ Ruby on Rails actionpack/lib/action_controller/metal/http_authentication.rb
7
+ with_http_digest Helper Method Remote DoS
4
8
 
5
- description: >
6
- Ruby on Rails contains a flaw that may allow a remote denial of
7
- service. The issue is triggered when an error occurs in
9
+ description: |
10
+ Ruby on Rails contains a flaw that may allow a remote denial of service.
11
+ The issue is triggered when an error occurs in
8
12
  actionpack/lib/action_controller/metal/http_authentication.rb when the
9
13
  with_http_digest helper method is being used. This may allow a remote
10
14
  attacker to cause a loss of availability for the program.
11
15
 
12
16
  cvss_v2: 4.3
13
17
 
14
- patched_versions:
18
+ patched_versions:
15
19
  - ~> 3.0.16
16
20
  - ~> 3.1.7
17
21
  - ">= 3.2.7"
@@ -0,0 +1,20 @@
1
+ ---
2
+ gem: actionpack
3
+ cve: 2012-3463
4
+ url: http://osvdb.org/84515
5
+ title: Ruby on Rails select_tag Helper Method prompt Value XSS
6
+
7
+ description: |
8
+ Ruby on Rails contains a flaw that allows a remote cross-site scripting (XSS)
9
+ attack. This flaw exists because input passed via the prompt value is not
10
+ properly sanitized by the select_tag helper method before returning it to
11
+ the user. This may allow a user to create a specially crafted request that
12
+ would execute arbitrary script code in a user's browser within the trust
13
+ relationship between their browser and the server.
14
+
15
+ cvss_v2: 4.3
16
+
17
+ patched_versions:
18
+ - ~> 3.0.17
19
+ - ~> 3.1.8
20
+ - ">= 3.2.8"
@@ -0,0 +1,20 @@
1
+ ---
2
+ gem: actionpack
3
+ cve: 2012-3465
4
+ url: http://www.osvdb.org/show/osvdb/84513
5
+ title: Ruby on Rails strip_tags Helper Method XSS
6
+
7
+ description: |
8
+ Ruby on Rails contains a flaw that allows a remote cross-site scripting (XSS)
9
+ attack. This flaw exists because the application does not validate input
10
+ passed via the 'strip_tags' helper method before returning it to the user.
11
+ This may allow a user to create a specially crafted request that would
12
+ execute arbitrary script code in a user's browser within the trust
13
+ relationship between their browser and the server.
14
+
15
+ cvss_v2: 4.3
16
+
17
+ patched_versions:
18
+ - ~> 3.0.17
19
+ - ~> 3.1.8
20
+ - ">= 3.2.8"
@@ -1,6 +1,8 @@
1
- ---
1
+ ---
2
+ gem: actionpack
3
+ cve: 2013-0156
2
4
  url: http://osvdb.org/show/osvdb/89026
3
- title: |
5
+ title:
4
6
  Ruby on Rails params_parser.rb Action Pack Type Casting Parameter Parsing
5
7
  Remote Code Execution
6
8
 
@@ -12,7 +14,7 @@ description: |
12
14
 
13
15
  cvss_v2: 10.0
14
16
 
15
- patched_versions:
17
+ patched_versions:
16
18
  - ~> 2.3.15
17
19
  - ~> 3.0.19
18
20
  - ~> 3.1.10
@@ -0,0 +1,21 @@
1
+ ---
2
+ gem: activerecord
3
+ cve: 2012-2660
4
+ url: http://www.osvdb.org/show/osvdb/82610
5
+ title:
6
+ Ruby on Rails ActiveRecord Class Rack Query Parameter Parsing SQL Query
7
+ Arbitrary IS NULL Clause Injection
8
+
9
+ description: |
10
+ Ruby on Rails contains a flaw related to the way ActiveRecord handles
11
+ parameters in conjunction with the way Rack parses query parameters.
12
+ This issue may allow an attacker to inject arbitrary 'IS NULL' clauses in
13
+ to application SQL queries. This may also allow an attacker to have the
14
+ SQL query check for NULL in arbitrary places.
15
+
16
+ cvss_v2: 7.5
17
+
18
+ patched_versions:
19
+ - ~> 3.0.13
20
+ - ~> 3.1.5
21
+ - ">= 3.2.4"
@@ -0,0 +1,19 @@
1
+ ---
2
+ gem: activerecord
3
+ cve: 2012-2661
4
+ url: http://www.osvdb.org/show/osvdb/82403
5
+ title: Ruby on Rails where Method ActiveRecord Class SQL Injection
6
+
7
+ description: |
8
+ Ruby on Rails (RoR) contains a flaw that may allow an attacker to carry out
9
+ an SQL injection attack. The issue is due to the ActiveRecord class not
10
+ properly sanitizing user-supplied input to the 'where' method. This may
11
+ allow an attacker to inject or manipulate SQL queries in an application
12
+ built on RoR, allowing for the manipulation or disclosure of arbitrary data.
13
+
14
+ cvss_v2: 5.0
15
+
16
+ patched_versions:
17
+ - ~> 3.0.13
18
+ - ~> 3.1.5
19
+ - ">= 3.2.4"