rack 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack might be problematic. Click here for more details.

@@ -479,11 +479,21 @@ run on port 11211) and memcache-client installed.
479
479
  * January 7th, 2013: Thirty first public release 1.4.3
480
480
  * Security: Prevent unbounded reads in large multipart boundaries
481
481
 
482
+ * January 13th, 2013: Thirty second public release 1.4.4, 1.3.9, 1.2.7, 1.1.5
483
+ * [SEC] Rack::Auth::AbstractRequest no longer symbolizes arbitrary strings
484
+ * Fixed erroneous test case in the 1.3.x series
485
+
482
486
  == Contact
483
487
 
484
488
  Please post bugs, suggestions and patches to
485
489
  the bug tracker at <http://github.com/rack/rack/issues>.
486
490
 
491
+ Please post security related bugs and suggestions to the core team at
492
+ <https://groups.google.com/group/rack-core> or rack-core@googlegroups.com. Due
493
+ to wide usage of the library, it is strongly preferred that we manage timing in
494
+ order to provide viable patches at the time of disclosure. Your assistance in
495
+ this matter is greatly appreciated.
496
+
487
497
  Mailing list archives are available at
488
498
  <http://groups.google.com/group/rack-devel>.
489
499
 
@@ -73,6 +73,18 @@ module Rack
73
73
  autoload :Params, "rack/auth/digest/params"
74
74
  autoload :Request, "rack/auth/digest/request"
75
75
  end
76
+
77
+ # Not all of the following schemes are "standards", but they are used often.
78
+ @schemes = %w[basic digest bearer mac token oauth oauth2]
79
+
80
+ def self.add_scheme scheme
81
+ @schemes << scheme
82
+ @schemes.uniq!
83
+ end
84
+
85
+ def self.schemes
86
+ @schemes.dup
87
+ end
76
88
  end
77
89
 
78
90
  module Session
@@ -21,7 +21,11 @@ module Rack
21
21
  end
22
22
 
23
23
  def scheme
24
- @scheme ||= parts.first.downcase.to_sym
24
+ @scheme ||=
25
+ begin
26
+ s = parts.first.downcase
27
+ Rack::Auth.schemes.include?(s) ? s.to_sym : s
28
+ end
25
29
  end
26
30
 
27
31
  def params
@@ -5,7 +5,6 @@ require 'tempfile'
5
5
  require 'rack/multipart'
6
6
 
7
7
  major, minor, patch = RUBY_VERSION.split('.').map { |v| v.to_i }
8
- ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
9
8
 
10
9
  if major == 1 && minor < 9
11
10
  require 'rack/backports/uri/common_18'
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rack"
3
- s.version = "1.4.3"
3
+ s.version = "1.4.4"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "a modular Ruby webserver interface"
6
6
 
@@ -0,0 +1,57 @@
1
+ require 'rack'
2
+
3
+ describe Rack::Auth do
4
+ it "should have all common authentication schemes" do
5
+ Rack::Auth.schemes.should.include? 'basic'
6
+ Rack::Auth.schemes.should.include? 'digest'
7
+ Rack::Auth.schemes.should.include? 'bearer'
8
+ Rack::Auth.schemes.should.include? 'token'
9
+ end
10
+
11
+ it "should allow registration of new auth schemes" do
12
+ Rack::Auth.schemes.should.not.include "test"
13
+ Rack::Auth.add_scheme "test"
14
+ Rack::Auth.schemes.should.include "test"
15
+ end
16
+ end
17
+
18
+ describe Rack::Auth::AbstractRequest do
19
+ it "should symbolize known auth schemes" do
20
+ env = Rack::MockRequest.env_for('/')
21
+ env['HTTP_AUTHORIZATION'] = 'Basic aXJyZXNwb25zaWJsZQ=='
22
+ req = Rack::Auth::AbstractRequest.new(env)
23
+ req.scheme.should.equal :basic
24
+
25
+
26
+ env['HTTP_AUTHORIZATION'] = 'Digest aXJyZXNwb25zaWJsZQ=='
27
+ req = Rack::Auth::AbstractRequest.new(env)
28
+ req.scheme.should.equal :digest
29
+
30
+ env['HTTP_AUTHORIZATION'] = 'Bearer aXJyZXNwb25zaWJsZQ=='
31
+ req = Rack::Auth::AbstractRequest.new(env)
32
+ req.scheme.should.equal :bearer
33
+
34
+ env['HTTP_AUTHORIZATION'] = 'MAC aXJyZXNwb25zaWJsZQ=='
35
+ req = Rack::Auth::AbstractRequest.new(env)
36
+ req.scheme.should.equal :mac
37
+
38
+ env['HTTP_AUTHORIZATION'] = 'Token aXJyZXNwb25zaWJsZQ=='
39
+ req = Rack::Auth::AbstractRequest.new(env)
40
+ req.scheme.should.equal :token
41
+
42
+ env['HTTP_AUTHORIZATION'] = 'OAuth aXJyZXNwb25zaWJsZQ=='
43
+ req = Rack::Auth::AbstractRequest.new(env)
44
+ req.scheme.should.equal :oauth
45
+
46
+ env['HTTP_AUTHORIZATION'] = 'OAuth2 aXJyZXNwb25zaWJsZQ=='
47
+ req = Rack::Auth::AbstractRequest.new(env)
48
+ req.scheme.should.equal :oauth2
49
+ end
50
+
51
+ it "should not symbolize unknown auth schemes" do
52
+ env = Rack::MockRequest.env_for('/')
53
+ env['HTTP_AUTHORIZATION'] = 'magic aXJyZXNwb25zaWJsZQ=='
54
+ req = Rack::Auth::AbstractRequest.new(env)
55
+ req.scheme.should == "magic"
56
+ end
57
+ end
@@ -142,7 +142,7 @@ describe Rack::Lock do
142
142
  should "unlock if the app throws" do
143
143
  lock = Lock.new
144
144
  env = Rack::MockRequest.env_for("/")
145
- app = lock_app(lambda {|env| throw :bacon }, lock)
145
+ app = lock_app(lambda {|_| throw :bacon }, lock)
146
146
  lambda { app.call(env) }.should.throw(:bacon)
147
147
  lock.synchronized.should.equal false
148
148
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 3
10
- version: 1.4.3
9
+ - 4
10
+ version: 1.4.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christian Neukirchen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-07 00:00:00 Z
18
+ date: 2013-01-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bacon
@@ -81,7 +81,7 @@ dependencies:
81
81
  requirements:
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- hash: -1379016806
84
+ hash: -2982847160
85
85
  segments:
86
86
  - 1
87
87
  - 2
@@ -237,6 +237,7 @@ files:
237
237
  - test/multipart/webkit
238
238
  - test/rackup/config.ru
239
239
  - test/registering_handler/rack/handler/registering_myself.rb
240
+ - test/spec_auth.rb
240
241
  - test/spec_auth_basic.rb
241
242
  - test/spec_auth_digest.rb
242
243
  - test/spec_body_proxy.rb
@@ -328,6 +329,7 @@ signing_key:
328
329
  specification_version: 3
329
330
  summary: a modular Ruby webserver interface
330
331
  test_files:
332
+ - test/spec_auth.rb
331
333
  - test/spec_auth_basic.rb
332
334
  - test/spec_auth_digest.rb
333
335
  - test/spec_body_proxy.rb