devise 1.1.3 → 1.1.4

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

Potentially problematic release.


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

@@ -1,3 +1,8 @@
1
+ == 1.1.4
2
+
3
+ * bugfix
4
+ * Avoid session fixation attacks
5
+
1
6
  == 1.1.3
2
7
 
3
8
  * bugfix
data/Gemfile CHANGED
@@ -1,18 +1,12 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rails", "3.0.0"
4
- gem "warden", "0.10.7"
3
+ gemspec
4
+
5
+ gem "rails", "3.0.1"
5
6
  gem "sqlite3-ruby"
6
- gem "webrat", "0.7.0"
7
+ gem "webrat", "0.7.1"
7
8
  gem "mocha", :require => false
8
- gem "bcrypt-ruby", :require => "bcrypt"
9
9
 
10
10
  if RUBY_VERSION < '1.9'
11
11
  gem "ruby-debug", ">= 0.10.3"
12
- end
13
-
14
- group :mongoid do
15
- gem "mongo"
16
- gem "mongoid", :git => "git://github.com/mongoid/mongoid.git"
17
- gem "bson_ext"
18
12
  end
@@ -1,24 +1,20 @@
1
- GIT
2
- remote: git://github.com/mongoid/mongoid.git
3
- revision: f38e3ef
1
+ PATH
2
+ remote: .
4
3
  specs:
5
- mongoid (2.0.0.beta.16)
6
- activemodel (~> 3.0.0)
7
- bson (= 1.0.4)
8
- mongo (= 1.0.7)
9
- tzinfo (~> 0.3.22)
10
- will_paginate (~> 3.0.pre)
4
+ devise (1.1.4)
5
+ bcrypt-ruby (~> 2.1.2)
6
+ warden (~> 1.0.2)
11
7
 
12
8
  GEM
13
9
  remote: http://rubygems.org/
14
10
  specs:
15
11
  abstract (1.0.0)
16
- actionmailer (3.0.0)
17
- actionpack (= 3.0.0)
12
+ actionmailer (3.0.1)
13
+ actionpack (= 3.0.1)
18
14
  mail (~> 2.2.5)
19
- actionpack (3.0.0)
20
- activemodel (= 3.0.0)
21
- activesupport (= 3.0.0)
15
+ actionpack (3.0.1)
16
+ activemodel (= 3.0.1)
17
+ activesupport (= 3.0.1)
22
18
  builder (~> 2.1.2)
23
19
  erubis (~> 2.6.6)
24
20
  i18n (~> 0.4.1)
@@ -26,89 +22,83 @@ GEM
26
22
  rack-mount (~> 0.6.12)
27
23
  rack-test (~> 0.5.4)
28
24
  tzinfo (~> 0.3.23)
29
- activemodel (3.0.0)
30
- activesupport (= 3.0.0)
25
+ activemodel (3.0.1)
26
+ activesupport (= 3.0.1)
31
27
  builder (~> 2.1.2)
32
28
  i18n (~> 0.4.1)
33
- activerecord (3.0.0)
34
- activemodel (= 3.0.0)
35
- activesupport (= 3.0.0)
29
+ activerecord (3.0.1)
30
+ activemodel (= 3.0.1)
31
+ activesupport (= 3.0.1)
36
32
  arel (~> 1.0.0)
37
33
  tzinfo (~> 0.3.23)
38
- activeresource (3.0.0)
39
- activemodel (= 3.0.0)
40
- activesupport (= 3.0.0)
41
- activesupport (3.0.0)
34
+ activeresource (3.0.1)
35
+ activemodel (= 3.0.1)
36
+ activesupport (= 3.0.1)
37
+ activesupport (3.0.1)
42
38
  arel (1.0.1)
43
39
  activesupport (~> 3.0.0)
44
40
  bcrypt-ruby (2.1.2)
45
- bson (1.0.4)
46
- bson_ext (1.0.7)
47
41
  builder (2.1.2)
48
- columnize (0.3.1)
42
+ columnize (0.3.2)
49
43
  erubis (2.6.6)
50
44
  abstract (>= 1.0.0)
51
- i18n (0.4.1)
45
+ i18n (0.4.2)
52
46
  linecache (0.43)
53
- mail (2.2.5)
47
+ mail (2.2.10)
54
48
  activesupport (>= 2.3.6)
55
- mime-types
56
- treetop (>= 1.4.5)
49
+ i18n (~> 0.4.1)
50
+ mime-types (~> 1.16)
51
+ treetop (~> 1.4.8)
57
52
  mime-types (1.16)
58
- mocha (0.9.8)
53
+ mocha (0.9.9)
59
54
  rake
60
- mongo (1.0.7)
61
- bson (>= 1.0.4)
62
- nokogiri (1.4.3.1)
55
+ nokogiri (1.4.4)
63
56
  polyglot (0.3.1)
64
57
  rack (1.2.1)
65
- rack-mount (0.6.12)
58
+ rack-mount (0.6.13)
66
59
  rack (>= 1.0.0)
67
- rack-test (0.5.4)
60
+ rack-test (0.5.6)
68
61
  rack (>= 1.0)
69
- rails (3.0.0)
70
- actionmailer (= 3.0.0)
71
- actionpack (= 3.0.0)
72
- activerecord (= 3.0.0)
73
- activeresource (= 3.0.0)
74
- activesupport (= 3.0.0)
62
+ rails (3.0.1)
63
+ actionmailer (= 3.0.1)
64
+ actionpack (= 3.0.1)
65
+ activerecord (= 3.0.1)
66
+ activeresource (= 3.0.1)
67
+ activesupport (= 3.0.1)
75
68
  bundler (~> 1.0.0)
76
- railties (= 3.0.0)
77
- railties (3.0.0)
78
- actionpack (= 3.0.0)
79
- activesupport (= 3.0.0)
69
+ railties (= 3.0.1)
70
+ railties (3.0.1)
71
+ actionpack (= 3.0.1)
72
+ activesupport (= 3.0.1)
80
73
  rake (>= 0.8.4)
81
74
  thor (~> 0.14.0)
82
75
  rake (0.8.7)
83
- ruby-debug (0.10.3)
76
+ ruby-debug (0.10.4)
84
77
  columnize (>= 0.1)
85
- ruby-debug-base (~> 0.10.3.0)
86
- ruby-debug-base (0.10.3)
78
+ ruby-debug-base (~> 0.10.4.0)
79
+ ruby-debug-base (0.10.4)
87
80
  linecache (>= 0.3)
88
- sqlite3-ruby (1.3.1)
89
- thor (0.14.0)
90
- treetop (1.4.8)
81
+ sqlite3-ruby (1.3.2)
82
+ thor (0.14.6)
83
+ treetop (1.4.9)
91
84
  polyglot (>= 0.3.1)
92
85
  tzinfo (0.3.23)
93
- warden (0.10.7)
86
+ warden (1.0.2)
94
87
  rack (>= 1.0.0)
95
- webrat (0.7.0)
88
+ webrat (0.7.1)
96
89
  nokogiri (>= 1.2.0)
97
90
  rack (>= 1.0)
98
91
  rack-test (>= 0.5.3)
99
- will_paginate (3.0.pre2)
100
92
 
101
93
  PLATFORMS
102
94
  ruby
103
95
 
104
96
  DEPENDENCIES
105
- bcrypt-ruby
106
- bson_ext
97
+ bcrypt-ruby (~> 2.1.2)
98
+ devise!
107
99
  mocha
108
- mongo
109
- mongoid!
110
- rails (= 3.0.0)
100
+ rails (= 3.0.1)
111
101
  ruby-debug (>= 0.10.3)
112
102
  sqlite3-ruby
113
- warden (= 0.10.7)
114
- webrat (= 0.7.0)
103
+ warden (~> 1.0.2)
104
+ webrat (= 0.7.1)
@@ -24,7 +24,7 @@ Right now it's composed of 11 modules:
24
24
 
25
25
  Devise 1.1 supports Rails 3 and is NOT backward compatible. You can use the latest Rails 3 beta gem with Devise latest gem:
26
26
 
27
- gem install devise --version=1.1.rc2
27
+ gem install devise --version=1.1.3
28
28
 
29
29
  If you want to use Rails master (from git repository) you need to use Devise from git repository and vice-versa.
30
30
 
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ begin
45
45
  s.authors = ['José Valim', 'Carlos Antônio']
46
46
  s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
47
47
  s.extra_rdoc_files = FileList["[A-Z]*"] - %w(Gemfile Rakefile)
48
- s.add_dependency("warden", "~> 0.10.7")
48
+ s.add_dependency("warden", "~> 1.0.2")
49
49
  s.add_dependency("bcrypt-ruby", "~> 2.1.2")
50
50
  end
51
51
 
@@ -265,6 +265,11 @@ module Devise
265
265
  @@warden_config_block = block
266
266
  end
267
267
 
268
+ # Returns true if Rails version is bigger than 3.0.x
269
+ def self.rack_session?
270
+ Rails::VERSION::STRING[0,3] != "3.0"
271
+ end
272
+
268
273
  # A method used internally to setup warden manager from the Rails initialize
269
274
  # block.
270
275
  def self.configure_warden! #:nodoc:
@@ -83,7 +83,7 @@ module Devise
83
83
  #
84
84
  def stored_location_for(resource_or_scope)
85
85
  scope = Devise::Mapping.find_scope!(resource_or_scope)
86
- session.delete(:"#{scope}_return_to")
86
+ session.delete("#{scope}_return_to")
87
87
  end
88
88
 
89
89
  # The default url to be used after signing in. This is used by all Devise
@@ -114,7 +114,7 @@ module Devise
114
114
  #
115
115
  def after_sign_in_path_for(resource_or_scope)
116
116
  scope = Devise::Mapping.find_scope!(resource_or_scope)
117
- home_path = :"#{scope}_root_path"
117
+ home_path = "#{scope}_root_path"
118
118
  respond_to?(home_path, true) ? send(home_path) : root_path
119
119
  end
120
120
 
@@ -36,4 +36,82 @@ class Warden::SessionSerializer
36
36
  raise
37
37
  end
38
38
  end
39
+ end
40
+
41
+ unless Devise.rack_session?
42
+ # We cannot use Rails Indifferent Hash because it messes up the flash object.
43
+ class Devise::IndifferentHash < Hash
44
+ alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
45
+ alias_method :regular_update, :update unless method_defined?(:regular_update)
46
+
47
+ def []=(key, value)
48
+ regular_writer(convert_key(key), value)
49
+ end
50
+
51
+ alias_method :store, :[]=
52
+
53
+ def update(other_hash)
54
+ other_hash.each_pair { |key, value| regular_writer(convert_key(key), value) }
55
+ self
56
+ end
57
+
58
+ alias_method :merge!, :update
59
+
60
+ def key?(key)
61
+ super(convert_key(key))
62
+ end
63
+
64
+ alias_method :include?, :key?
65
+ alias_method :has_key?, :key?
66
+ alias_method :member?, :key?
67
+
68
+ def fetch(key, *extras)
69
+ super(convert_key(key), *extras)
70
+ end
71
+
72
+ def values_at(*indices)
73
+ indices.collect {|key| self[convert_key(key)]}
74
+ end
75
+
76
+ def merge(hash)
77
+ self.dup.update(hash)
78
+ end
79
+
80
+ def delete(key)
81
+ super(convert_key(key))
82
+ end
83
+
84
+ def stringify_keys!; self end
85
+ def stringify_keys; dup end
86
+
87
+ undef :symbolize_keys!
88
+ def symbolize_keys; to_hash.symbolize_keys end
89
+
90
+ def to_options!; self end
91
+
92
+ protected
93
+
94
+ def convert_key(key)
95
+ key.kind_of?(Symbol) ? key.to_s : key
96
+ end
97
+ end
98
+
99
+ class ActionDispatch::Request
100
+ def reset_session
101
+ session.destroy if session && session.respond_to?(:destroy)
102
+ self.session = {}
103
+ @env['action_dispatch.request.flash_hash'] = nil
104
+ end
105
+ end
106
+
107
+ Warden::Manager.after_set_user :event => [:set_user, :authentication] do |record, warden, options|
108
+ if options[:scope] && warden.authenticated?(options[:scope])
109
+ request, flash = warden.request, warden.env['action_dispatch.request.flash_hash']
110
+ backup = request.session.to_hash
111
+ backup.delete("session_id")
112
+ request.reset_session
113
+ warden.env['action_dispatch.request.flash_hash'] = flash
114
+ request.session = Devise::IndifferentHash.new.update(backup)
115
+ end
116
+ end
39
117
  end
@@ -1,3 +1,3 @@
1
1
  module Devise
2
- VERSION = "1.1.3".freeze
2
+ VERSION = "1.1.4".freeze
3
3
  end
@@ -236,6 +236,17 @@ class AuthenticationSessionTest < ActionController::IntegrationTest
236
236
  get '/users'
237
237
  assert_equal "Cart", @controller.user_session[:cart]
238
238
  end
239
+
240
+ test 'session id is changed on sign in' do
241
+ get '/users'
242
+ session_id = request.session["session_id"]
243
+
244
+ get '/users'
245
+ assert_equal session_id, request.session["session_id"]
246
+
247
+ sign_in_as_user
248
+ assert_not_equal session_id, request.session["session_id"]
249
+ end
239
250
  end
240
251
 
241
252
  class AuthenticationWithScopesTest < ActionController::IntegrationTest
@@ -1,9 +1,9 @@
1
- require 'webrat/core/elements/field'
1
+ require 'webrat/core/elements/form'
2
2
  require 'action_dispatch/testing/integration'
3
3
 
4
4
  module Webrat
5
- Field.class_eval do
6
- def parse_rails_request_params(params)
5
+ Form.class_eval do
6
+ def self.parse_rails_request_params(params)
7
7
  Rack::Utils.parse_nested_query(params)
8
8
  end
9
9
  end
@@ -13,20 +13,5 @@ module ActionDispatch #:nodoc:
13
13
  IntegrationTest.class_eval do
14
14
  include Webrat::Methods
15
15
  include Webrat::Matchers
16
-
17
- # The Rails version of within supports passing in a model and Webrat
18
- # will apply a scope based on Rails' dom_id for that model.
19
- #
20
- # Example:
21
- # within User.last do
22
- # click_link "Delete"
23
- # end
24
- def within(selector_or_object, &block)
25
- if selector_or_object.is_a?(String)
26
- super
27
- else
28
- super('#' + RecordIdentifier.dom_id(selector_or_object), &block)
29
- end
30
- end
31
16
  end
32
- end
17
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 3
10
- version: 1.1.3
9
+ - 4
10
+ version: 1.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Jos\xC3\xA9 Valim"
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-24 00:00:00 +02:00
19
+ date: 2010-11-26 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,12 +27,12 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- hash: 57
30
+ hash: 19
31
31
  segments:
32
+ - 1
32
33
  - 0
33
- - 10
34
- - 7
35
- version: 0.10.7
34
+ - 2
35
+ version: 1.0.2
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency