redis-actionpack 5.1.0 → 5.2.0.pre

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: 50331ac51d096b49792a7490a0ac690f3ccd4477
4
- data.tar.gz: 695156ecc06eb6baf1e041495d50fd39a551f24a
3
+ metadata.gz: 3e2b6211a9e93d7d4437bd0a16154812f0490980
4
+ data.tar.gz: d6393f01d6f54f7cec47f5aaf8b96b8024cd15d7
5
5
  SHA512:
6
- metadata.gz: fbca26251d84472ca25c2dec76c78c9202e1d38b097418845524ddf90035533189ebba3f5efc00b5148c4b35da1c06f69fad6add4382770da0969086f90b2db1
7
- data.tar.gz: c30bdf4ed278f3b953a5872cc9c58fbef181e4fefd69978f9e6347b86d7c9b11fd8df765c1eda40863b89952aa820e5597239ebd9f88d63bbb011c910a06019f
6
+ metadata.gz: 49599e9033bb2cec8f544ad965203ff74cf53110fc9977ed95ad1e4c8fe7fd4bc84bc86525e65bec6a867b3402570bf37d36f145abad2293d2da13581c24fd8b
7
+ data.tar.gz: 5a855c54e08114d9145f432991c4b642a429d9f3819904bb535c525d0adcc3280c425ec92d4d31bb43d5cb0efc2ef82ad215866b3e869b17d0354194178166fa
@@ -0,0 +1,2 @@
1
+ assignees:
2
+ - tubbo
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  Gemfile.lock
2
- test/gemfiles/*.lock
2
+ gemfiles/*.lock
3
3
  *.gem
4
4
  tmp/
5
5
  stdout
6
+ gemfiles/vendor
@@ -2,23 +2,26 @@ language: ruby
2
2
  before_install: gem install bundler
3
3
  script: bundle exec rake
4
4
  rvm:
5
- - 2.3
6
- - 2.4
7
- - 2.5
8
- - 2.6
9
- - ruby-head
5
+ - 2.3
6
+ - 2.4
7
+ - 2.5
8
+ - 2.6
9
+ - ruby-head
10
+ - jruby-head
10
11
  gemfile:
11
- - test/gemfiles/Gemfile.rails-4.0.x
12
- - test/gemfiles/Gemfile.rails-4.1.x
13
- - test/gemfiles/Gemfile.rails-4.2.x
14
- - test/gemfiles/Gemfile.rails-5.0.x
12
+ - gemfiles/rails_5.0.x.gemfile
13
+ - gemfiles/rails_5.1.x.gemfile
14
+ - gemfiles/rails_5.2.x.gemfile
15
+ - gemfiles/rails_6.0.x.gemfile
15
16
  matrix:
16
17
  exclude:
17
- - rvm: 2.1
18
- gemfile: test/gemfiles/Gemfile.rails-5.0.x
18
+ - rvm: 2.3
19
+ gemfile: gemfiles/rails_6.0.x.gemfile
20
+ - rvm: 2.4
21
+ gemfile: gemfiles/rails_6.0.x.gemfile
19
22
  allow_failures:
20
- - rvm: ruby-head
21
- - rvm: jruby-head
23
+ - rvm: ruby-head
24
+ - rvm: jruby-head
22
25
  deploy:
23
26
  provider: rubygems
24
27
  api_key:
@@ -0,0 +1,23 @@
1
+ appraise 'rails-5.0.x' do
2
+ gem 'redis-store'
3
+ gem 'redis-rack'
4
+ gem 'actionpack', '~> 5.0.0'
5
+ end
6
+
7
+ appraise 'rails-5.1.x' do
8
+ gem 'redis-store'
9
+ gem 'redis-rack'
10
+ gem 'actionpack', '~> 5.1.0'
11
+ end
12
+
13
+ appraise 'rails-5.2.x' do
14
+ gem 'redis-store'
15
+ gem 'redis-rack'
16
+ gem 'actionpack', '~> 5.1.0'
17
+ end
18
+
19
+ appraise 'rails-6.0.x' do
20
+ gem 'redis-store'
21
+ gem 'redis-rack'
22
+ gem 'actionpack', '~> 6.0.0'
23
+ end
data/README.md CHANGED
@@ -17,12 +17,39 @@ gem 'redis-actionpack'
17
17
 
18
18
  ## Usage
19
19
 
20
- If you are using redis-store with Rails, consider using the [redis-rails gem](https://github.com/redis-store/redis-rails) instead. For standalone usage:
20
+ If you are using redis-store with Rails, head on over to the
21
+ [redis-rails README](https://github.com/redis-store/redis-rails#session-storage) to
22
+ learn how to integrate this gem into your Rails application.
23
+
24
+ For standalone usage:
21
25
 
22
26
  ```ruby
23
- ActionController::Base.cache_store = ActionDispatch::Session::RedisStore.new
27
+ ActionController::Base.session_store = :redis_store,
28
+ servers: %w(redis://localhost:6379/0/session),
29
+ expire_after: 90.minutes,
30
+ key: '_my_application_session',
31
+ threadsafe: false,
32
+ signed: true,
33
+ secure: true
24
34
  ```
25
35
 
36
+ A brief run-down of these options...
37
+
38
+ - **servers** is an Array of Redis server URLs that we will attempt to find
39
+ data from.
40
+ - **expire_after** is the default TTL of session keys. This is also set
41
+ as the expiry time of any cookies generated by the session store.
42
+ - **key** is the name of the cookie on the client side
43
+ - **threadsafe** is for applications that run on multiple instances. Set
44
+ this to `false` if you want to disable the global mutex lock on
45
+ session data. It's `true` by default, meaning the mutex will be
46
+ enabled.
47
+ - **signed** uses signed/encrypted cookies to store the local session on
48
+ a client machine, preventing a malicious user from tampering with its
49
+ contents.
50
+ - **secure** ensures HTTP cookies are transferred from server to client
51
+ on a secure (HTTPS) connection
52
+
26
53
  ## Running tests
27
54
 
28
55
  ```shell
@@ -37,8 +64,8 @@ If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bun
37
64
 
38
65
  ## Status
39
66
 
40
- [![Gem Version](https://badge.fury.io/rb/redis-actionpack.svg)](http://badge.fury.io/rb/redis-actionpack)
41
- [![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.svg?branch=master)](http://travis-ci.org/redis-store/redis-actionpack?branch=master)
67
+ [![Gem Version](https://badge.fury.io/rb/redis-actionpack.svg)](http://badge.fury.io/rb/redis-actionpack)
68
+ [![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.svg?branch=master)](http://travis-ci.org/redis-store/redis-actionpack?branch=master)
42
69
  [![Code Climate](https://codeclimate.com/github/redis-store/redis-actionpack.svg)](https://codeclimate.com/github/redis-store/redis-actionpack)
43
70
 
44
71
  ## Copyright
@@ -0,0 +1 @@
1
+ puts '-v 1.13.1' if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.3.0')
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "redis-store"
6
+ gem "redis-rack"
7
+ gem "actionpack", "~> 5.0.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "redis-store"
6
+ gem "redis-rack"
7
+ gem "actionpack", "~> 5.1.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "redis-store"
6
+ gem "redis-rack"
7
+ gem "actionpack", "~> 5.1.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "redis-store"
6
+ gem "redis-rack"
7
+ gem "actionpack", "~> 6.0.0"
8
+
9
+ gemspec path: "../"
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'redis-store'
2
4
  require 'redis-rack'
3
5
  require 'action_dispatch/middleware/session/abstract_store'
4
6
 
5
7
  module ActionDispatch
6
8
  module Session
9
+ # Session storage in Redis, using +Redis::Rack+ as a basis.
7
10
  class RedisStore < Rack::Session::Redis
8
11
  include Compatibility
9
12
  include StaleSessionCheck
@@ -17,18 +20,31 @@ module ActionDispatch
17
20
 
18
21
  private
19
22
 
20
- def set_cookie(env, session_id, cookie)
21
- if env.is_a? ActionDispatch::Request
22
- request = env
23
- else
24
- request = ActionDispatch::Request.new(env)
25
- end
26
- request.cookie_jar[key] = cookie.merge(cookie_options)
23
+ def set_cookie(env, _session_id, cookie)
24
+ request = wrap_in_request(env)
25
+ cookie_jar(request)[key] = cookie.merge(cookie_options)
26
+ end
27
+
28
+ def get_cookie(request)
29
+ cookie_jar(request)[key]
30
+ end
31
+
32
+ def wrap_in_request(env)
33
+ return env if env.is_a?(ActionDispatch::Request)
34
+ ActionDispatch::Request.new(env)
27
35
  end
28
36
 
29
37
  def cookie_options
30
38
  @default_options.slice(:httponly, :secure)
31
39
  end
40
+
41
+ def cookie_jar(request)
42
+ if @default_options[:signed]
43
+ request.cookie_jar.signed_or_encrypted
44
+ else
45
+ request.cookie_jar
46
+ end
47
+ end
32
48
  end
33
49
  end
34
50
  end
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  module ActionPack
3
- VERSION = '5.1.0'
3
+ VERSION = '5.2.0.pre'
4
4
  end
5
5
  end
@@ -14,18 +14,19 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.executables = []
18
18
  s.require_paths = ['lib']
19
+ s.required_ruby_version = '>= 2.3.0'
19
20
 
20
21
  s.add_runtime_dependency 'redis-store', '>= 1.1.0', '< 2'
21
22
  s.add_runtime_dependency 'redis-rack', '>= 1', '< 3'
22
- s.add_runtime_dependency 'actionpack', '>= 4.0', '< 7'
23
+ s.add_runtime_dependency 'actionpack', '>= 5', '< 7'
23
24
 
24
25
  s.add_development_dependency 'rake', '~> 10'
25
- s.add_development_dependency 'bundler'
26
+ s.add_development_dependency 'bundler', '> 1', '< 3'
26
27
  s.add_development_dependency 'mocha', '~> 0.14.0'
27
28
  s.add_development_dependency 'minitest-rails'
28
29
  s.add_development_dependency 'tzinfo'
29
- # s.add_development_dependency 'mini_backtrace'
30
30
  s.add_development_dependency 'redis-store-testing'
31
+ s.add_development_dependency 'appraisal'
31
32
  end
@@ -5,7 +5,6 @@ gem 'redis-store'
5
5
 
6
6
  gem 'redis-rack', github: 'redis-store/redis-rack'
7
7
 
8
- gem 'actionpack', '~> 5.0.0'
8
+ gem 'actionpack', '~> 6.0.0'
9
9
 
10
10
  gem 'minitest-rails'
11
-
@@ -69,6 +69,20 @@ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
69
69
  end
70
70
  end
71
71
 
72
+ test "should set a signed cookie when the 'signed' option is set" do
73
+ with_test_route_set(signed: true) do
74
+ https!
75
+
76
+ get '/set_session_value'
77
+ assert_response :success
78
+
79
+ cookie = cookies.instance_variable_get('@cookies').first
80
+
81
+ assert_includes cookie.raw, '_session_id='
82
+ end
83
+ end
84
+
85
+
72
86
  test "should set a http-only cookie by default" do
73
87
  with_test_route_set do
74
88
  get '/set_session_value'
@@ -238,8 +252,17 @@ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
238
252
  def initialize(routes, &blk)
239
253
  @routes = routes
240
254
  @stack = ActionDispatch::MiddlewareStack.new(&blk).build(@routes)
255
+ @secret = SecureRandom.hex
256
+ @key_generator = ActiveSupport::CachingKeyGenerator.new(
257
+ ActiveSupport::KeyGenerator.new(@secret, iterations: 2)
258
+ )
241
259
  end
242
260
  def call(env)
261
+ env[ActionDispatch::Cookies::GENERATOR_KEY] = @key_generator
262
+ env[ActionDispatch::Cookies::SIGNED_COOKIE_SALT] = SecureRandom.hex
263
+ if defined? ActionDispatch::Cookies::COOKIES_ROTATIONS
264
+ env[ActionDispatch::Cookies::COOKIES_ROTATIONS] = ActiveSupport::Messages::RotationConfiguration.new
265
+ end
243
266
  @stack.call(env)
244
267
  end
245
268
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-22 00:00:00.000000000 Z
11
+ date: 2019-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-store
@@ -56,7 +56,7 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '4.0'
59
+ version: '5'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '7'
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '4.0'
69
+ version: '5'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '7'
@@ -88,16 +88,22 @@ dependencies:
88
88
  name: bundler
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ">="
91
+ - - ">"
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: '1'
94
+ - - "<"
95
+ - !ruby/object:Gem::Version
96
+ version: '3'
94
97
  type: :development
95
98
  prerelease: false
96
99
  version_requirements: !ruby/object:Gem::Requirement
97
100
  requirements:
98
- - - ">="
101
+ - - ">"
99
102
  - !ruby/object:Gem::Version
100
- version: '0'
103
+ version: '1'
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '3'
101
107
  - !ruby/object:Gem::Dependency
102
108
  name: mocha
103
109
  requirement: !ruby/object:Gem::Requirement
@@ -154,6 +160,20 @@ dependencies:
154
160
  - - ">="
155
161
  - !ruby/object:Gem::Version
156
162
  version: '0'
163
+ - !ruby/object:Gem::Dependency
164
+ name: appraisal
165
+ requirement: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ type: :development
171
+ prerelease: false
172
+ version_requirements: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
157
177
  description: Redis session store for ActionPack
158
178
  email:
159
179
  - me@lucaguidi.com
@@ -161,13 +181,20 @@ executables: []
161
181
  extensions: []
162
182
  extra_rdoc_files: []
163
183
  files:
184
+ - ".github/auto-assign-issues.yml"
164
185
  - ".gitignore"
165
186
  - ".travis.yml"
187
+ - Appraisals
166
188
  - CODEOWNERS
167
189
  - Gemfile
168
190
  - MIT-LICENSE
169
191
  - README.md
170
192
  - Rakefile
193
+ - bin/bundler-version-options.rb
194
+ - gemfiles/rails_5.0.x.gemfile
195
+ - gemfiles/rails_5.1.x.gemfile
196
+ - gemfiles/rails_5.2.x.gemfile
197
+ - gemfiles/rails_6.0.x.gemfile
171
198
  - lib/action_dispatch/middleware/session/redis_store.rb
172
199
  - lib/redis-actionpack.rb
173
200
  - lib/redis/actionpack/version.rb
@@ -184,10 +211,7 @@ files:
184
211
  - test/dummy/config/routes.rb
185
212
  - test/dummy/script/rails
186
213
  - test/fixtures/session_autoload_test/session_autoload_test/foo.rb
187
- - test/gemfiles/Gemfile.rails-4.0.x
188
- - test/gemfiles/Gemfile.rails-4.1.x
189
- - test/gemfiles/Gemfile.rails-4.2.x
190
- - test/gemfiles/Gemfile.rails-5.0.x
214
+ - test/gemfiles/Gemfile.rails-6.0.x
191
215
  - test/integration/redis_store_integration_test.rb
192
216
  - test/test_helper.rb
193
217
  homepage: http://redis-store.org/redis-actionpack
@@ -202,12 +226,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
226
  requirements:
203
227
  - - ">="
204
228
  - !ruby/object:Gem::Version
205
- version: '0'
229
+ version: 2.3.0
206
230
  required_rubygems_version: !ruby/object:Gem::Requirement
207
231
  requirements:
208
- - - ">="
232
+ - - ">"
209
233
  - !ruby/object:Gem::Version
210
- version: '0'
234
+ version: 1.3.1
211
235
  requirements: []
212
236
  rubyforge_project:
213
237
  rubygems_version: 2.6.14
@@ -227,9 +251,6 @@ test_files:
227
251
  - test/dummy/config/routes.rb
228
252
  - test/dummy/script/rails
229
253
  - test/fixtures/session_autoload_test/session_autoload_test/foo.rb
230
- - test/gemfiles/Gemfile.rails-4.0.x
231
- - test/gemfiles/Gemfile.rails-4.1.x
232
- - test/gemfiles/Gemfile.rails-4.2.x
233
- - test/gemfiles/Gemfile.rails-5.0.x
254
+ - test/gemfiles/Gemfile.rails-6.0.x
234
255
  - test/integration/redis_store_integration_test.rb
235
256
  - test/test_helper.rb
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec :path => './../..'
3
-
4
- gem 'redis-store', '~> 1.1.0'
5
-
6
- gem 'redis-rack', '~> 1.5.0'
7
-
8
- gem 'actionpack', '~> 4.0.0'
9
-
10
- gem 'minitest-rails', '~> 1.0.0'
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec :path => './../..'
3
-
4
- gem 'redis-store', '~> 1.1.0'
5
-
6
- gem 'redis-rack', '~> 1.5.0'
7
-
8
- gem 'actionpack', '~> 4.1.0'
9
-
10
- gem 'minitest-rails', '~> 2.2.0'
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec :path => './../..'
3
-
4
- gem 'redis-store', '~> 1.1.0'
5
-
6
- gem 'redis-rack', '~> 1.5.0'
7
-
8
- gem 'actionpack', '~> 4.2.0'
9
-
10
- gem 'minitest-rails', '~> 2.2.0'