redis-actionpack 5.3.0 → 5.5.0

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
  SHA256:
3
- metadata.gz: ffc2d2ea9d57234131426d376aa94d658e2cf707cde8e7144dcff4fef3939b11
4
- data.tar.gz: b2a9f00678e5e34e4821ab1f718783db3d4eee0d164dcf7b6f1eb8a6e864a442
3
+ metadata.gz: 28f0d4976af13727e86f22c78bc411c6f87f98c6073b864376efa1902c9e17c2
4
+ data.tar.gz: bd544e2fe6845154d55aad77d3c1cac832224b3f770e50740e67da8a5e30d20d
5
5
  SHA512:
6
- metadata.gz: f3cee21add22e6d2391a46db594203328dcafac71168d923faffac6da024aecab243d7f39ee3a3591dec78c1154618a5d98ba0ac1e60a91e353d8d47dc5d99ca
7
- data.tar.gz: aa76e0b1f6bfadcc472f52481df23013f51a5678a8f3f736c669b87ca51047d8a2bd690fc12a2471e842561e90c24adf79feb0399adeec42eb87f01d3975b0d1
6
+ metadata.gz: ab5b3822d6b8bf9cf3e297b950b6c16fa2f37cf3b944da3036affe468e52591b8d83485ce9ae65f102150c3bd2b61932a6e41332d8c056630fa7b327423a90cb
7
+ data.tar.gz: 4358c1cc800ae2b542e66432045c6afaa0db2d08ef8ff712b9c436f3a7b62f9826e81d39f11f359f7b02df650ebb49fb4b981600521fef2638abd8ec396e995b
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,13 @@
1
+ changelog:
2
+ exclude:
3
+ labels: [dependencies]
4
+ authors: [renovate-bot]
5
+ categories:
6
+ - title: Breaking Changes
7
+ labels: [breaking]
8
+ - title: New Features
9
+ labels: [enhancement]
10
+ - title: Bug Fixes
11
+ labels: [bug]
12
+ - title: Other Changes
13
+ labels: ["*"]
@@ -0,0 +1,101 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ tags-ignore: [v*]
8
+ pull_request:
9
+ branches:
10
+ - master
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ test:
18
+ name: "test (ruby: ${{ matrix.ruby }}, rails: ${{ matrix.rails }})"
19
+ runs-on: ubuntu-latest
20
+ continue-on-error: ${{ contains(matrix.ruby, 'head') }}
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ ruby:
25
+ - "2.7"
26
+ - "3.0"
27
+ - "3.1"
28
+ - "3.2"
29
+ - "3.3"
30
+ # - 'head'
31
+ # - "jruby"
32
+ # - 'jruby-head'
33
+ # - "truffleruby"
34
+ # - 'truffleruby-head'
35
+ rails:
36
+ - rails_8.0
37
+ - rails_7.2
38
+ - rails_7.1
39
+ - rails_7.0
40
+ - rails_6.1
41
+ - rails_6.0
42
+ - rails_5.2
43
+ - rails_5.1
44
+ - rails_5.0
45
+
46
+ exclude:
47
+ - ruby: '2.7'
48
+ rails: 'rails_7.2'
49
+ - ruby: '2.7'
50
+ rails: 'rails_8.0'
51
+
52
+ - ruby: '3.0'
53
+ rails: 'rails_5.0'
54
+ - ruby: '3.0'
55
+ rails: 'rails_5.1'
56
+ - ruby: '3.0'
57
+ rails: 'rails_5.2'
58
+ - ruby: '3.0'
59
+ rails: 'rails_7.2'
60
+ - ruby: '3.0'
61
+ rails: 'rails_8.0'
62
+
63
+ - ruby: '3.1'
64
+ rails: 'rails_5.0'
65
+ - ruby: '3.1'
66
+ rails: 'rails_5.1'
67
+ - ruby: '3.1'
68
+ rails: 'rails_5.2'
69
+ - ruby: '3.1'
70
+ rails: 'rails_8.0'
71
+
72
+ - ruby: '3.2'
73
+ rails: 'rails_5.0'
74
+ - ruby: '3.2'
75
+ rails: 'rails_5.1'
76
+ - ruby: '3.2'
77
+ rails: 'rails_5.2'
78
+
79
+ - ruby: '3.3'
80
+ rails: 'rails_5.0'
81
+ - ruby: '3.3'
82
+ rails: 'rails_5.1'
83
+ - ruby: '3.3'
84
+ rails: 'rails_5.2'
85
+
86
+ env:
87
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}.gemfile
88
+
89
+ services:
90
+ redis:
91
+ image: redis
92
+ ports:
93
+ - 6379:6379
94
+
95
+ steps:
96
+ - uses: actions/checkout@v4
97
+ - uses: ruby/setup-ruby@v1
98
+ with:
99
+ ruby-version: ${{ matrix.ruby }}
100
+ bundler-cache: true
101
+ - run: bundle exec rake
@@ -0,0 +1,32 @@
1
+ name: Publish
2
+ on:
3
+ push:
4
+ tags: [v*]
5
+ permissions:
6
+ contents: write
7
+ concurrency:
8
+ group: ${{ github.workflow }}-${{ github.ref }}
9
+ cancel-in-progress: true
10
+ jobs:
11
+ release:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: "3.1"
18
+ bundler-cache: true
19
+ - run: |
20
+ mkdir -p ~/.gem
21
+ cat << EOF > ~/.gem/credentials
22
+ ---
23
+ :rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
24
+ EOF
25
+
26
+ chmod 0600 ~/.gem/credentials
27
+ - run: bundle exec rake release
28
+ - uses: softprops/action-gh-release@v1
29
+ with:
30
+ files: "*.gem"
31
+ generate_release_notes: true
32
+ prerelease: ${{ contains(github.ref, '.pre') }}
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ gemfiles/*.lock
4
4
  tmp/
5
5
  stdout
6
6
  gemfiles/vendor
7
+ .DS_Store
data/Appraisals CHANGED
@@ -1,23 +1,64 @@
1
- appraise 'rails-5.0.x' do
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'rails_5.0' do
2
4
  gem 'redis-store'
3
5
  gem 'redis-rack'
4
6
  gem 'actionpack', '~> 5.0.0'
7
+ gem 'tzinfo', '~> 1.2'
5
8
  end
6
9
 
7
- appraise 'rails-5.1.x' do
10
+ appraise 'rails_5.1' do
8
11
  gem 'redis-store'
9
12
  gem 'redis-rack'
10
13
  gem 'actionpack', '~> 5.1.0'
14
+ gem 'tzinfo', '~> 1.2'
11
15
  end
12
16
 
13
- appraise 'rails-5.2.x' do
17
+ appraise 'rails_5.2' do
14
18
  gem 'redis-store'
15
19
  gem 'redis-rack'
16
- gem 'actionpack', '~> 5.1.0'
20
+ gem 'actionpack', '~> 5.2.0'
21
+ gem 'tzinfo', '~> 1.2'
17
22
  end
18
23
 
19
- appraise 'rails-6.0.x' do
24
+ appraise 'rails_6.0' do
20
25
  gem 'redis-store'
21
26
  gem 'redis-rack'
22
27
  gem 'actionpack', '~> 6.0.0'
28
+ gem 'tzinfo', '~> 1.2'
29
+ end
30
+
31
+ appraise 'rails_6.1' do
32
+ gem 'redis-store'
33
+ gem 'redis-rack'
34
+ gem 'actionpack', '~> 6.1.0'
35
+ end
36
+
37
+ appraise 'rails_7.0' do
38
+ gem 'redis-store'
39
+ gem 'redis-rack'
40
+ gem 'actionpack', '~> 7.0.0'
41
+ end
42
+
43
+ appraise 'rails_7.1' do
44
+ gem 'redis-store'
45
+ gem 'redis-rack'
46
+ gem 'actionpack', '~> 7.1.0'
47
+ end
48
+
49
+ appraise 'rails_7.2' do
50
+ gem 'redis-store'
51
+ gem 'redis-rack'
52
+ gem 'actionpack', '~> 7.2.0'
53
+ end
54
+
55
+ appraise 'rails_8.0' do
56
+ gem 'redis-store'
57
+ gem 'redis-rack'
58
+ gem 'actionpack', '~> 8.0.0'
59
+
60
+ # TODO: remove me when one of this PR is merged:
61
+ # * https://github.com/minitest/minitest-rails/pull/258
62
+ # * https://github.com/minitest/minitest-rails/pull/259
63
+ gem 'minitest-rails', git: 'https://github.com/n-rodriguez/minitest-rails.git', branch: 'wip/rails8'
23
64
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ v5.4.0 (2023-12-05)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Update gemspec to contain source code url
5
+ Igor Drozdov
6
+
7
+ * Allow redis-rack 3.x
8
+ Nicolas Rodriguez
9
+
10
+ v5.3.0 (2022-01-17)
11
+ --------------------------------------------------------------------------------
12
+
13
+ * Support actionpack 7
14
+ Shodai Suzuki
15
+
16
+
1
17
  v5.2.0 (2020-01-13)
2
18
  --------------------------------------------------------------------------------
3
19
 
data/Gemfile CHANGED
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
  gemspec
3
5
 
4
- gem 'rake', '>= 12.3.3'
5
- gem 'bundler', '~> 2.1'
6
+ gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git'
7
+
8
+ gem 'cgi'
9
+ gem 'minitest-rails'
6
10
  gem 'mocha', '~> 0.14.0', require: 'mocha/setup'
7
- gem 'tzinfo', '~> 1.2'
8
- gem 'appraisal', '~> 2.2'
11
+ gem 'rake', '>= 12.3.3'
9
12
  gem 'redis-store-testing', github: 'redis-store/testing'
10
- gem 'minitest-rails'
13
+ gem 'tzinfo'
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Redis stores for ActionPack
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/redis-actionpack.svg)](http://badge.fury.io/rb/redis-actionpack)
4
+ [![Build Status](https://github.com/redis-store/redis-actionpack/workflows/CI/badge.svg)](https://github.com/redis-store/redis-actionpack/actions)
5
+ [![Code Climate](https://codeclimate.com/github/redis-store/redis-actionpack.svg)](https://codeclimate.com/github/redis-store/redis-actionpack)
6
+
3
7
  __`redis-actionpack`__ provides a session store for __ActionPack__, specifically for __ActionDispatch__. See the main [redis-store readme](https://github.com/redis-store/redis-store) for general guidelines.
4
8
 
5
9
  For guidelines on using our underlying cache store, see the main [redis-store readme](https://github.com/redis-store/redis-store).
@@ -58,12 +62,6 @@ bundle exec rake
58
62
 
59
63
  If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bundle exec rake`
60
64
 
61
- ## Status
62
-
63
- [![Gem Version](https://badge.fury.io/rb/redis-actionpack.svg)](http://badge.fury.io/rb/redis-actionpack)
64
- [![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.svg?branch=master)](http://travis-ci.org/redis-store/redis-actionpack?branch=master)
65
- [![Code Climate](https://codeclimate.com/github/redis-store/redis-actionpack.svg)](https://codeclimate.com/github/redis-store/redis-actionpack)
66
-
67
65
  ## Copyright
68
66
 
69
67
  2009 - 2013 Luca Guidi - [http://lucaguidi.com](http://lucaguidi.com), released under the MIT license
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'rake'
3
5
  require 'bundler/gem_tasks'
@@ -2,13 +2,13 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rake", ">= 12.3.3"
6
- gem "bundler", "~> 2.1"
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails"
7
8
  gem "mocha", "~> 0.14.0", require: "mocha/setup"
8
- gem "tzinfo", "~> 1.2"
9
- gem "appraisal", "~> 2.2"
9
+ gem "rake", ">= 12.3.3"
10
10
  gem "redis-store-testing", github: "redis-store/testing"
11
- gem "minitest-rails"
11
+ gem "tzinfo", "~> 1.2"
12
12
  gem "redis-store"
13
13
  gem "redis-rack"
14
14
  gem "actionpack", "~> 5.0.0"
@@ -2,13 +2,13 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rake", ">= 12.3.3"
6
- gem "bundler", "~> 2.1"
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails"
7
8
  gem "mocha", "~> 0.14.0", require: "mocha/setup"
8
- gem "tzinfo", "~> 1.2"
9
- gem "appraisal", "~> 2.2"
9
+ gem "rake", ">= 12.3.3"
10
10
  gem "redis-store-testing", github: "redis-store/testing"
11
- gem "minitest-rails"
11
+ gem "tzinfo", "~> 1.2"
12
12
  gem "redis-store"
13
13
  gem "redis-rack"
14
14
  gem "actionpack", "~> 5.1.0"
@@ -2,15 +2,15 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rake", ">= 12.3.3"
6
- gem "bundler", "~> 2.1"
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails"
7
8
  gem "mocha", "~> 0.14.0", require: "mocha/setup"
8
- gem "tzinfo", "~> 1.2"
9
- gem "appraisal", "~> 2.2"
9
+ gem "rake", ">= 12.3.3"
10
10
  gem "redis-store-testing", github: "redis-store/testing"
11
- gem "minitest-rails"
11
+ gem "tzinfo", "~> 1.2"
12
12
  gem "redis-store"
13
13
  gem "redis-rack"
14
- gem "actionpack", "~> 5.1.0"
14
+ gem "actionpack", "~> 5.2.0"
15
15
 
16
16
  gemspec path: "../"
@@ -2,13 +2,13 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rake", ">= 12.3.3"
6
- gem "bundler", "~> 2.1"
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails"
7
8
  gem "mocha", "~> 0.14.0", require: "mocha/setup"
8
- gem "tzinfo", "~> 1.2"
9
- gem "appraisal", "~> 2.2"
9
+ gem "rake", ">= 12.3.3"
10
10
  gem "redis-store-testing", github: "redis-store/testing"
11
- gem "minitest-rails"
11
+ gem "tzinfo", "~> 1.2"
12
12
  gem "redis-store"
13
13
  gem "redis-rack"
14
14
  gem "actionpack", "~> 6.0.0"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails"
8
+ gem "mocha", "~> 0.14.0", require: "mocha/setup"
9
+ gem "rake", ">= 12.3.3"
10
+ gem "redis-store-testing", github: "redis-store/testing"
11
+ gem "tzinfo"
12
+ gem "redis-store"
13
+ gem "redis-rack"
14
+ gem "actionpack", "~> 6.1.0"
15
+
16
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails"
8
+ gem "mocha", "~> 0.14.0", require: "mocha/setup"
9
+ gem "rake", ">= 12.3.3"
10
+ gem "redis-store-testing", github: "redis-store/testing"
11
+ gem "tzinfo"
12
+ gem "redis-store"
13
+ gem "redis-rack"
14
+ gem "actionpack", "~> 7.0.0"
15
+
16
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails"
8
+ gem "mocha", "~> 0.14.0", require: "mocha/setup"
9
+ gem "rake", ">= 12.3.3"
10
+ gem "redis-store-testing", github: "redis-store/testing"
11
+ gem "tzinfo"
12
+ gem "redis-store"
13
+ gem "redis-rack"
14
+ gem "actionpack", "~> 7.1.0"
15
+
16
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails"
8
+ gem "mocha", "~> 0.14.0", require: "mocha/setup"
9
+ gem "rake", ">= 12.3.3"
10
+ gem "redis-store-testing", github: "redis-store/testing"
11
+ gem "tzinfo"
12
+ gem "redis-store"
13
+ gem "redis-rack"
14
+ gem "actionpack", "~> 7.2.0"
15
+
16
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
6
+ gem "cgi"
7
+ gem "minitest-rails", git: "https://github.com/n-rodriguez/minitest-rails.git", branch: "wip/rails8"
8
+ gem "mocha", "~> 0.14.0", require: "mocha/setup"
9
+ gem "rake", ">= 12.3.3"
10
+ gem "redis-store-testing", github: "redis-store/testing"
11
+ gem "tzinfo"
12
+ gem "redis-store"
13
+ gem "redis-rack"
14
+ gem "actionpack", "~> 8.0.0"
15
+
16
+ gemspec path: "../"
@@ -35,6 +35,7 @@ module ActionDispatch
35
35
 
36
36
  def wrap_in_request(env)
37
37
  return env if env.is_a?(ActionDispatch::Request)
38
+
38
39
  ActionDispatch::Request.new(env)
39
40
  end
40
41
 
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Redis
2
4
  module ActionPack
3
- VERSION = '5.3.0'
5
+ VERSION = '5.5.0'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'redis-store'
2
4
  require 'action_pack'
3
5
  require 'redis/actionpack/version'
@@ -1,24 +1,25 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
3
- require 'redis/actionpack/version'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/redis/actionpack/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'redis-actionpack'
7
7
  s.version = Redis::ActionPack::VERSION
8
8
  s.authors = ['Luca Guidi']
9
9
  s.email = ['me@lucaguidi.com']
10
- s.homepage = 'http://redis-store.org/redis-actionpack'
11
- s.summary = %q{Redis session store for ActionPack}
10
+ s.homepage = 'https://redis-store.org/redis-actionpack/'
11
+ s.summary = 'Redis session store for ActionPack'
12
12
  s.description = "#{s.summary}. Used for storing the Rails session in Redis."
13
13
  s.license = 'MIT'
14
+ s.metadata = {
15
+ 'source_code_uri' => 'https://github.com/redis-store/redis-actionpack'
16
+ }
17
+
18
+ s.required_ruby_version = '>= 2.7.0'
14
19
 
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = []
18
- s.require_paths = ['lib']
19
- s.required_ruby_version = '>= 2.3.0'
20
+ s.files = `git ls-files`.split("\n")
20
21
 
21
- s.add_runtime_dependency 'redis-store', '>= 1.1.0', '< 2'
22
- s.add_runtime_dependency 'redis-rack', '>= 2.1.0', '< 3'
23
- s.add_runtime_dependency 'actionpack', '>= 5', '< 8'
22
+ s.add_dependency 'actionpack', '>= 5'
23
+ s.add_dependency 'redis-rack', '>= 2.1.0', '< 4'
24
+ s.add_dependency 'redis-store', '>= 1.1.0', '< 2'
24
25
  end
@@ -1,5 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
+ return unless Gem::Version.new(ActiveSupport.version) < Gem::Version.new('7.2')
4
+
3
5
  class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
4
6
  SessionKey = '_session_id'
5
7
  SessionSecret = 'b3c631c314c0bbca50c1b2843150fe33'
@@ -29,7 +31,11 @@ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
29
31
  get '/set_session_value'
30
32
  assert_response :success
31
33
  assert cookies['_session_id'].present?
32
- session_cookie = cookies.send(:hash_for)['_session_id']
34
+ if cookies.respond_to?(:get_cookie)
35
+ session_cookie = cookies.get_cookie('_session_id')
36
+ else
37
+ session_cookie = cookies.send(:hash_for)['_session_id']
38
+ end
33
39
 
34
40
  get '/call_reset_session'
35
41
  assert_response :success
@@ -91,7 +97,11 @@ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
91
97
  cookie = cookies.instance_variable_get('@cookies').first
92
98
  options = cookie.instance_variable_get('@options')
93
99
 
94
- assert options.key?('HttpOnly')
100
+ if Gem::Version.new(ActiveSupport.version) < Gem::Version.new('7.1')
101
+ assert options.key?('HttpOnly')
102
+ else
103
+ assert options.key?('httponly')
104
+ end
95
105
  end
96
106
  end
97
107
 
@@ -103,7 +113,11 @@ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
103
113
  cookie = cookies.instance_variable_get('@cookies').first
104
114
  options = cookie.instance_variable_get('@options')
105
115
 
106
- assert !options.key?('HttpOnly')
116
+ if Gem::Version.new(ActiveSupport.version) < Gem::Version.new('7.1')
117
+ assert !options.key?('HttpOnly')
118
+ else
119
+ assert !options.key?('httponly')
120
+ end
107
121
  end
108
122
  end
109
123
 
@@ -240,7 +254,7 @@ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
240
254
  test "session store with all domains" do
241
255
  with_test_route_set(:domain => :all) do
242
256
  get '/set_session_value'
243
- assert_match(/domain=\.example\.com/, headers['Set-Cookie'])
257
+ assert_match(/domain=\.?example\.com/, headers['Set-Cookie'])
244
258
  end
245
259
  end
246
260
 
@@ -0,0 +1,342 @@
1
+ require 'test_helper'
2
+
3
+ return unless Gem::Version.new(ActiveSupport.version) >= Gem::Version.new('7.2')
4
+
5
+ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
6
+ SessionKey = '_session_id'
7
+ SessionSecret = 'b3c631c314c0bbca50c1b2843150fe33'
8
+
9
+ test "reads the data" do
10
+ with_test_route_set do
11
+ get '/set_session_value'
12
+ assert_response :success
13
+ assert cookies['_session_id'].present?
14
+
15
+ get '/get_session_value'
16
+ assert_response :success
17
+ assert_equal response.body, 'foo: "bar"'
18
+ end
19
+ end
20
+
21
+ test "should get nil session value" do
22
+ with_test_route_set do
23
+ get '/get_session_value'
24
+ assert_response :success
25
+ assert_equal 'foo: nil', response.body
26
+ end
27
+ end
28
+
29
+ test "should delete the data after session reset" do
30
+ with_test_route_set do
31
+ get '/set_session_value'
32
+ assert_response :success
33
+ assert cookies['_session_id'].present?
34
+ if cookies.respond_to?(:get_cookie)
35
+ session_cookie = cookies.get_cookie('_session_id')
36
+ else
37
+ session_cookie = cookies.send(:hash_for)['_session_id']
38
+ end
39
+
40
+ get '/call_reset_session'
41
+ assert_response :success
42
+ assert !headers['Set-Cookie'].blank?
43
+
44
+ cookies << session_cookie
45
+
46
+ get '/get_session_value'
47
+ assert_response :success
48
+ assert_equal 'foo: nil', response.body
49
+ end
50
+ end
51
+
52
+ test "should set a non-secure cookie by default" do
53
+ with_test_route_set do
54
+ https!
55
+
56
+ get '/set_session_value'
57
+ assert_response :success
58
+
59
+ cookie = cookies.instance_variable_get('@cookies').first
60
+
61
+ assert !cookie.secure?
62
+ end
63
+ end
64
+
65
+ test "should set a secure cookie when the 'secure' option is set" do
66
+ cookie_options(secure: true)
67
+
68
+ with_test_route_set do
69
+ https!
70
+
71
+ get '/set_session_value'
72
+ assert_response :success
73
+
74
+ cookie = cookies.instance_variable_get('@cookies').first
75
+
76
+ assert cookie.secure?
77
+ end
78
+ end
79
+
80
+ test "should set a signed cookie when the 'signed' option is set" do
81
+ cookie_options(signed: true)
82
+
83
+ with_test_route_set do
84
+ https!
85
+
86
+ get '/set_session_value'
87
+ assert_response :success
88
+
89
+ cookie = cookies.instance_variable_get('@cookies').first
90
+
91
+ assert_includes cookie.raw, '_session_id='
92
+ end
93
+ end
94
+
95
+
96
+ test "should set a http-only cookie by default" do
97
+ with_test_route_set do
98
+ get '/set_session_value'
99
+ assert_response :success
100
+
101
+ cookie = cookies.instance_variable_get('@cookies').first
102
+ options = cookie.instance_variable_get('@options')
103
+
104
+ if Gem::Version.new(ActiveSupport.version) < Gem::Version.new('7.1')
105
+ assert options.key?('HttpOnly')
106
+ else
107
+ assert options.key?('httponly')
108
+ end
109
+ end
110
+ end
111
+
112
+ test "should set a non-http-only cookie when the 'httponlty' option is set to false" do
113
+ cookie_options(httponly: false)
114
+
115
+ with_test_route_set do
116
+ get '/set_session_value'
117
+ assert_response :success
118
+
119
+ cookie = cookies.instance_variable_get('@cookies').first
120
+ options = cookie.instance_variable_get('@options')
121
+
122
+ if Gem::Version.new(ActiveSupport.version) < Gem::Version.new('7.1')
123
+ assert !options.key?('HttpOnly')
124
+ else
125
+ assert !options.key?('httponly')
126
+ end
127
+ end
128
+ end
129
+
130
+ test "should not send cookies on write, not read" do
131
+ with_test_route_set do
132
+ get '/get_session_value'
133
+ assert_response :success
134
+ assert_equal 'foo: nil', response.body
135
+ assert cookies['_session_id'].nil?
136
+ end
137
+ end
138
+
139
+ test "should set session value after session reset" do
140
+ with_test_route_set do
141
+ get '/set_session_value'
142
+ assert_response :success
143
+ assert cookies['_session_id'].present?
144
+ session_id = cookies['_session_id']
145
+
146
+ get '/call_reset_session'
147
+ assert_response :success
148
+ assert !headers['Set-Cookie'].blank?
149
+
150
+ get '/get_session_value'
151
+ assert_response :success
152
+ assert_equal 'foo: nil', response.body
153
+
154
+ get '/get_session_id'
155
+ assert_response :success
156
+ assert(response.body != session_id)
157
+ end
158
+ end
159
+
160
+ test "should be able to read session id without accessing the session hash" do
161
+ with_test_route_set do
162
+ get '/set_session_value'
163
+ assert_response :success
164
+ assert cookies['_session_id'].present?
165
+ session_id = cookies['_session_id']
166
+
167
+ get '/get_session_id'
168
+ assert_response :success
169
+ assert_equal response.body, session_id
170
+ end
171
+ end
172
+
173
+ test "should auto-load unloaded class" do
174
+ with_test_route_set do
175
+ with_autoload_path "session_autoload_test" do
176
+ get '/set_serialized_session_value'
177
+ assert_response :success
178
+ assert cookies['_session_id'].present?
179
+ end
180
+
181
+ with_autoload_path "session_autoload_test" do
182
+ get '/get_session_id'
183
+ assert_response :success
184
+ end
185
+
186
+ with_autoload_path "session_autoload_test" do
187
+ get '/get_session_value'
188
+ assert_response :success
189
+ assert_equal response.body, 'foo: #<SessionAutoloadTest::Foo bar:"baz">'
190
+ end
191
+ end
192
+ end
193
+
194
+ test "should not resend the cookie again if session_id cookie is already exists" do
195
+ with_test_route_set do
196
+ get '/set_session_value'
197
+ assert_response :success
198
+ assert cookies['_session_id'].present?
199
+
200
+ get '/get_session_value'
201
+ assert_response :success
202
+ assert headers['Set-Cookie'].nil?
203
+ end
204
+ end
205
+
206
+ test "should prevent session fixation" do
207
+ with_test_route_set do
208
+ get '/get_session_value'
209
+ assert_response :success
210
+ assert_equal 'foo: nil', response.body
211
+ session_id = cookies['_session_id']
212
+
213
+ reset!
214
+
215
+ get '/set_session_value', headers: { _session_id: session_id }
216
+ assert_response :success
217
+ assert(cookies['_session_id'] != session_id)
218
+ end
219
+ end
220
+
221
+ test "should write the data with expiration time" do
222
+ with_test_route_set do
223
+ get '/set_session_value_with_expiry'
224
+ assert_response :success
225
+
226
+ get '/get_session_value'
227
+ assert_response :success
228
+ assert_equal response.body, 'foo: "bar"'
229
+
230
+ sleep 1
231
+
232
+ get '/get_session_value'
233
+ assert_response :success
234
+ assert_equal 'foo: nil', response.body
235
+ end
236
+ end
237
+
238
+ test "session store with explicit domain" do
239
+ cookie_options(:domain => "example.es")
240
+
241
+ with_test_route_set do
242
+ get '/set_session_value'
243
+ assert_match(/domain=example\.es/, headers['Set-Cookie'])
244
+ headers['Set-Cookie']
245
+ end
246
+ end
247
+
248
+ test "session store without domain" do
249
+ with_test_route_set do
250
+ get '/set_session_value'
251
+ assert_no_match(/domain\=/, headers['Set-Cookie'])
252
+ end
253
+ end
254
+
255
+ test "session store with nil domain" do
256
+ cookie_options(:domain => nil)
257
+
258
+ with_test_route_set do
259
+ get '/set_session_value'
260
+ assert_no_match(/domain\=/, headers['Set-Cookie'])
261
+ end
262
+ end
263
+
264
+ test "session store with all domains" do
265
+ cookie_options(:domain => :all)
266
+
267
+ with_test_route_set do
268
+ get '/set_session_value'
269
+ assert_match(/domain=\.?example\.com/, headers['Set-Cookie'])
270
+ end
271
+ end
272
+
273
+ private
274
+
275
+ def cookie_options(options = {})
276
+ (@cookie_options ||= { key: SessionKey }).merge!(options)
277
+ end
278
+
279
+ def app
280
+ @app ||= self.class.build_app do |middleware|
281
+ middleware.use ActionDispatch::Session::RedisStore, cookie_options
282
+ end
283
+ end
284
+
285
+ # from actionpack/test/abstract_unit.rb
286
+ class RoutedRackApp
287
+ class Config < Struct.new(:middleware)
288
+ end
289
+
290
+ attr_reader :routes
291
+
292
+ def initialize(routes, &blk)
293
+ @routes = routes
294
+ @stack = ActionDispatch::MiddlewareStack.new(&blk)
295
+ @app = @stack.build(@routes)
296
+ @secret = SecureRandom.hex
297
+ @key_generator = ActiveSupport::CachingKeyGenerator.new(
298
+ ActiveSupport::KeyGenerator.new(@secret, iterations: 2)
299
+ )
300
+ end
301
+ def call(env)
302
+ env[ActionDispatch::Cookies::GENERATOR_KEY] = @key_generator
303
+ env[ActionDispatch::Cookies::SIGNED_COOKIE_SALT] = SecureRandom.hex
304
+ if defined? ActionDispatch::Cookies::COOKIES_ROTATIONS
305
+ env[ActionDispatch::Cookies::COOKIES_ROTATIONS] = ActiveSupport::Messages::RotationConfiguration.new
306
+ end
307
+ @app.call(env)
308
+ end
309
+ def config
310
+ Config.new(@stack)
311
+ end
312
+ end
313
+
314
+ # from actionpack/test/abstract_unit.rb
315
+ def self.build_app(routes = nil)
316
+ RoutedRackApp.new(routes || ActionDispatch::Routing::RouteSet.new) do |middleware|
317
+ middleware.use ActionDispatch::DebugExceptions
318
+ middleware.use ActionDispatch::Callbacks
319
+ # middleware.use ActionDispatch::ParamsParser
320
+ middleware.use ActionDispatch::Cookies
321
+ middleware.use ActionDispatch::Flash
322
+ middleware.use Rack::Head
323
+ yield(middleware) if block_given?
324
+ end
325
+ end
326
+
327
+ # from actionpack/test/dispatch/session/cookie_store_test.rb
328
+ def with_test_route_set
329
+ with_routing do |set|
330
+ set.draw do
331
+ get :no_session_access, to: 'test#no_session_access'
332
+ get :set_session_value, to: 'test#set_session_value'
333
+ get :set_session_value_with_expiry, to: 'test#set_session_value_with_expiry'
334
+ get :set_serialized_session_value, to: 'test#set_serialized_session_value'
335
+ get :get_session_value, to: 'test#get_session_value'
336
+ get :get_session_id, to: 'test#get_session_id'
337
+ get :call_reset_session, to: 'test#call_reset_session'
338
+ end
339
+ yield
340
+ end
341
+ end
342
+ end
data/test/test_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bundler/setup'
2
2
  require 'minitest/autorun'
3
+ require 'active_support'
3
4
  require 'active_support/core_ext/numeric/time'
4
5
 
5
6
  ENV["RAILS_ENV"] = "test"
@@ -8,17 +9,33 @@ require "rails/test_help"
8
9
 
9
10
  Rails.backtrace_cleaner.remove_silencers!
10
11
 
11
- def with_autoload_path(path)
12
- path = File.join(File.dirname(__FILE__), "fixtures", path)
13
- if ActiveSupport::Dependencies.autoload_paths.include?(path)
14
- yield
15
- else
16
- begin
17
- ActiveSupport::Dependencies.autoload_paths << path
12
+
13
+ if Gem::Version.new(ActiveSupport.version) > Gem::Version.new('7.0')
14
+ # See: https://github.com/rails/rails/blob/v7.0.0/actionpack/test/abstract_unit.rb#L161
15
+ def with_autoload_path(path)
16
+ path = File.join(__dir__, "fixtures", path)
17
+ Zeitwerk.with_loader do |loader|
18
+ loader.push_dir(path)
19
+ loader.setup
18
20
  yield
19
21
  ensure
20
- ActiveSupport::Dependencies.autoload_paths.reject! {|p| p == path}
21
- ActiveSupport::Dependencies.clear
22
+ loader.unload
23
+ end
24
+ end
25
+ else
26
+ # See: https://github.com/rails/rails/blob/v6.1.0/actionpack/test/abstract_unit.rb#L162
27
+ def with_autoload_path(path)
28
+ path = File.join(File.dirname(__FILE__), "fixtures", path)
29
+ if ActiveSupport::Dependencies.autoload_paths.include?(path)
30
+ yield
31
+ else
32
+ begin
33
+ ActiveSupport::Dependencies.autoload_paths << path
34
+ yield
35
+ ensure
36
+ ActiveSupport::Dependencies.autoload_paths.reject! {|p| p == path}
37
+ ActiveSupport::Dependencies.clear
38
+ end
22
39
  end
23
40
  end
24
41
  end
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-17 00:00:00.000000000 Z
11
+ date: 2024-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: redis-store
14
+ name: actionpack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '2'
19
+ version: '5'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 1.1.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '2'
26
+ version: '5'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: redis-rack
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +33,7 @@ dependencies:
39
33
  version: 2.1.0
40
34
  - - "<"
41
35
  - !ruby/object:Gem::Version
42
- version: '3'
36
+ version: '4'
43
37
  type: :runtime
44
38
  prerelease: false
45
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,27 +43,27 @@ dependencies:
49
43
  version: 2.1.0
50
44
  - - "<"
51
45
  - !ruby/object:Gem::Version
52
- version: '3'
46
+ version: '4'
53
47
  - !ruby/object:Gem::Dependency
54
- name: actionpack
48
+ name: redis-store
55
49
  requirement: !ruby/object:Gem::Requirement
56
50
  requirements:
57
51
  - - ">="
58
52
  - !ruby/object:Gem::Version
59
- version: '5'
53
+ version: 1.1.0
60
54
  - - "<"
61
55
  - !ruby/object:Gem::Version
62
- version: '8'
56
+ version: '2'
63
57
  type: :runtime
64
58
  prerelease: false
65
59
  version_requirements: !ruby/object:Gem::Requirement
66
60
  requirements:
67
61
  - - ">="
68
62
  - !ruby/object:Gem::Version
69
- version: '5'
63
+ version: 1.1.0
70
64
  - - "<"
71
65
  - !ruby/object:Gem::Version
72
- version: '8'
66
+ version: '2'
73
67
  description: Redis session store for ActionPack. Used for storing the Rails session
74
68
  in Redis.
75
69
  email:
@@ -79,8 +73,11 @@ extensions: []
79
73
  extra_rdoc_files: []
80
74
  files:
81
75
  - ".github/auto-assign-issues.yml"
76
+ - ".github/dependabot.yml"
77
+ - ".github/release.yml"
78
+ - ".github/workflows/ci.yml"
79
+ - ".github/workflows/publish.yml"
82
80
  - ".gitignore"
83
- - ".travis.yml"
84
81
  - Appraisals
85
82
  - CHANGELOG.md
86
83
  - CODEOWNERS
@@ -88,11 +85,15 @@ files:
88
85
  - MIT-LICENSE
89
86
  - README.md
90
87
  - Rakefile
91
- - bin/bundler-version-options.rb
92
- - gemfiles/rails_5.0.x.gemfile
93
- - gemfiles/rails_5.1.x.gemfile
94
- - gemfiles/rails_5.2.x.gemfile
95
- - gemfiles/rails_6.0.x.gemfile
88
+ - gemfiles/rails_5.0.gemfile
89
+ - gemfiles/rails_5.1.gemfile
90
+ - gemfiles/rails_5.2.gemfile
91
+ - gemfiles/rails_6.0.gemfile
92
+ - gemfiles/rails_6.1.gemfile
93
+ - gemfiles/rails_7.0.gemfile
94
+ - gemfiles/rails_7.1.gemfile
95
+ - gemfiles/rails_7.2.gemfile
96
+ - gemfiles/rails_8.0.gemfile
96
97
  - lib/action_dispatch/middleware/session/redis_store.rb
97
98
  - lib/redis-actionpack.rb
98
99
  - lib/redis/actionpack/version.rb
@@ -107,15 +108,15 @@ files:
107
108
  - test/dummy/config/boot.rb
108
109
  - test/dummy/config/environment.rb
109
110
  - test/dummy/config/routes.rb
110
- - test/dummy/script/rails
111
111
  - test/fixtures/session_autoload_test/session_autoload_test/foo.rb
112
- - test/gemfiles/Gemfile.rails-6.0.x
113
- - test/integration/redis_store_integration_test.rb
112
+ - test/integration/default/redis_store_integration_test.rb
113
+ - test/integration/rails7.2/redis_store_integration_test.rb
114
114
  - test/test_helper.rb
115
- homepage: http://redis-store.org/redis-actionpack
115
+ homepage: https://redis-store.org/redis-actionpack/
116
116
  licenses:
117
117
  - MIT
118
- metadata: {}
118
+ metadata:
119
+ source_code_uri: https://github.com/redis-store/redis-actionpack
119
120
  post_install_message:
120
121
  rdoc_options: []
121
122
  require_paths:
@@ -124,30 +125,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
125
  requirements:
125
126
  - - ">="
126
127
  - !ruby/object:Gem::Version
127
- version: 2.3.0
128
+ version: 2.7.0
128
129
  required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  requirements:
130
131
  - - ">="
131
132
  - !ruby/object:Gem::Version
132
133
  version: '0'
133
134
  requirements: []
134
- rubygems_version: 3.2.11
135
+ rubygems_version: 3.4.10
135
136
  signing_key:
136
137
  specification_version: 4
137
138
  summary: Redis session store for ActionPack
138
- test_files:
139
- - test/dummy/.gitignore
140
- - test/dummy/Rakefile
141
- - test/dummy/app/controllers/test_controller.rb
142
- - test/dummy/app/views/test/get_session_id.html.erb
143
- - test/dummy/app/views/test/get_session_value.html.erb
144
- - test/dummy/config.ru
145
- - test/dummy/config/application.rb
146
- - test/dummy/config/boot.rb
147
- - test/dummy/config/environment.rb
148
- - test/dummy/config/routes.rb
149
- - test/dummy/script/rails
150
- - test/fixtures/session_autoload_test/session_autoload_test/foo.rb
151
- - test/gemfiles/Gemfile.rails-6.0.x
152
- - test/integration/redis_store_integration_test.rb
153
- - test/test_helper.rb
139
+ test_files: []
data/.travis.yml DELETED
@@ -1,33 +0,0 @@
1
- language: ruby
2
- before_install: gem install bundler
3
- script: bundle exec rake
4
- rvm:
5
- - 2.3
6
- - 2.4
7
- - 2.5
8
- - 2.6
9
- - 2.7
10
- - ruby-head
11
- - jruby-head
12
- gemfile:
13
- - gemfiles/rails_5.0.x.gemfile
14
- - gemfiles/rails_5.1.x.gemfile
15
- - gemfiles/rails_5.2.x.gemfile
16
- - gemfiles/rails_6.0.x.gemfile
17
- matrix:
18
- exclude:
19
- - rvm: 2.3
20
- gemfile: gemfiles/rails_6.0.x.gemfile
21
- - rvm: 2.4
22
- gemfile: gemfiles/rails_6.0.x.gemfile
23
- allow_failures:
24
- - rvm: ruby-head
25
- - rvm: jruby-head
26
- deploy:
27
- provider: rubygems
28
- api_key:
29
- secure: edRiCZPzp3pqBQn3hjeG5WqUNf0eEb8/Ea2VY0jJfQfOHxOYJSATkpdZ5xxOL1YIefk7ERUURY3dKwS/qdSIF2h954QPeOChLTlSaWtFjSNAZIAhH7Ks4vN/q1i7JAWtJRCBOtHlAe9AJj7CvHpUsry3+oHsJ+gXaaA9lntbheE=
30
- gem: redis-actionpack
31
- on:
32
- tags: true
33
- repo: redis-store/redis-actionpack
@@ -1 +0,0 @@
1
- puts '-v 1.13.1' if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.3.0')
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec :path => './../..'
3
-
4
- gem 'redis-store'
5
-
6
- gem 'redis-rack', github: 'redis-store/redis-rack'
7
-
8
- gem 'actionpack', '~> 6.0.0'
9
-
10
- gem 'minitest-rails'