clearance 2.1.0 → 2.4.0

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

Potentially problematic release.


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

Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.erb-lint.yml +5 -0
  3. data/.github/workflows/tests.yml +52 -0
  4. data/Appraisals +14 -19
  5. data/Gemfile +11 -7
  6. data/Gemfile.lock +140 -85
  7. data/NEWS.md +62 -0
  8. data/README.md +23 -12
  9. data/RELEASING.md +25 -0
  10. data/Rakefile +6 -1
  11. data/app/controllers/clearance/passwords_controller.rb +2 -3
  12. data/app/views/clearance_mailer/change_password.html.erb +2 -2
  13. data/app/views/clearance_mailer/change_password.text.erb +2 -2
  14. data/app/views/passwords/edit.html.erb +1 -1
  15. data/clearance.gemspec +1 -0
  16. data/gemfiles/rails_5.0.gemfile +10 -9
  17. data/gemfiles/rails_5.1.gemfile +11 -10
  18. data/gemfiles/rails_5.2.gemfile +11 -10
  19. data/gemfiles/rails_6.0.gemfile +11 -10
  20. data/gemfiles/rails_6.1.gemfile +21 -0
  21. data/lib/clearance/back_door.rb +2 -1
  22. data/lib/clearance/configuration.rb +19 -0
  23. data/lib/clearance/password_strategies.rb +2 -5
  24. data/lib/clearance/password_strategies/argon2.rb +23 -0
  25. data/lib/clearance/rack_session.rb +1 -1
  26. data/lib/clearance/session.rb +24 -12
  27. data/lib/clearance/user.rb +11 -2
  28. data/lib/clearance/version.rb +1 -1
  29. data/lib/generators/clearance/install/install_generator.rb +4 -1
  30. data/spec/clearance/back_door_spec.rb +20 -4
  31. data/spec/clearance/rack_session_spec.rb +1 -2
  32. data/spec/clearance/session_spec.rb +116 -43
  33. data/spec/configuration_spec.rb +28 -0
  34. data/spec/generators/clearance/install/install_generator_spec.rb +8 -2
  35. data/spec/mailers/clearance_mailer_spec.rb +33 -0
  36. data/spec/models/user_spec.rb +29 -0
  37. data/spec/password_strategies/argon2_spec.rb +79 -0
  38. data/spec/support/clearance.rb +11 -0
  39. data/spec/support/request_with_remember_token.rb +8 -6
  40. metadata +29 -4
  41. data/.travis.yml +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a955d1866bf1879846034e89ca4f5a85cdf4602e67667e1ba93fae12ec5c832e
4
- data.tar.gz: 3e2c19f661f4910f0bf6c31a12dfae58b44c4a49283750e07ae28eb33ced6d17
3
+ metadata.gz: bf42dbdfbd60820a6690813fef30b305ffa76ca93852ad6183ce499d1fa51413
4
+ data.tar.gz: 9832b513dcc54672a809b326334d0967266113027d35f4a57add919a7f222201
5
5
  SHA512:
6
- metadata.gz: c8a2870d5567ae747cccbeda37a88fc6f31d5fca6cac57d2d2cbdb7016e22112f413c19a73b8f0edeb390b01ee04efe8da4633b69a2bd629bbfdfd2b6dbbbe5d
7
- data.tar.gz: ed611c62911b8ac335ae12fd6af9e4eeaa36b6541451ec2322b29a07820b6eb6d2ce3232262cc75d69697e2530e93746ee0089911e9b7ff39ee9ef64961fbe15
6
+ metadata.gz: 6a4921201ae474f99af273a1cf524e63a76e868b4470bcf8972ea4ed368bfdd62ae7597c8a8d9b9bffe08803b62d2725fa49737b6b66319eb8b877719bf26d45
7
+ data.tar.gz: 9f38b6e9870112874cabe5c4402bd22984d90713d2ac2b18b157893ba7787777783452528948877e5bcf3bfe5549abce78f8e0f85877f1661a1ea11adb66248f
data/.erb-lint.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ EnableDefaultLinters: true
3
+ linters:
4
+ ErbSafety:
5
+ enabled: true
@@ -0,0 +1,52 @@
1
+ name: CI Tests
2
+
3
+ on:
4
+ push:
5
+ branches: "master"
6
+ pull_request:
7
+ branches: "*"
8
+
9
+ jobs:
10
+ test:
11
+ name: "Ruby ${{ matrix.ruby }}, Rails ${{ matrix.gemfile }}"
12
+
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ gemfile:
19
+ - "5.0"
20
+ - "5.1"
21
+ - "5.2"
22
+ - "6.0"
23
+ - "6.1"
24
+ ruby:
25
+ - "2.4.9"
26
+ - "2.5.7"
27
+ - "2.6.5"
28
+ - "2.7.2"
29
+ exclude:
30
+ - gemfile: "6.0"
31
+ ruby: "2.4.9"
32
+ - gemfile: "6.1"
33
+ ruby: "2.4.9"
34
+
35
+ env:
36
+ BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.gemfile }}.gemfile
37
+ RAILS_ENV: test
38
+
39
+ steps:
40
+ - uses: actions/checkout@v2
41
+
42
+ - name: "Install Ruby ${{ matrix.ruby }}"
43
+ uses: ruby/setup-ruby@v1
44
+ with:
45
+ ruby-version: ${{ matrix.ruby }}
46
+ bundler-cache: true
47
+
48
+ - name: "Reset app database"
49
+ run: bundle exec rake dummy:db:reset
50
+
51
+ - name: "Run tests"
52
+ run: bundle exec rake
data/Appraisals CHANGED
@@ -1,23 +1,18 @@
1
- rails_versions = %w(
2
- 5.0
3
- 5.1
4
- 5.2
5
- 6.0
6
- )
1
+ appraise "rails_5.0" do
2
+ gem "railties", "~> 5.0"
3
+ gem 'rspec-rails', '~> 3.1'
4
+ gem 'capybara', '>= 2.6.2', '< 3.33.0'
5
+ gem 'sqlite3', '~> 1.3.13'
6
+ end
7
7
 
8
- rails_versions.each do |version|
9
- appraise "rails_#{version}" do
10
- gem "railties", "~> #{version}.0"
11
- gem "rails-controller-testing"
8
+ appraise "rails_5.1" do
9
+ gem "railties", "~> 5.1"
10
+ end
12
11
 
13
- if Gem::Version.new(version) >= Gem::Version.new("6.0")
14
- # TODO - Switch to 4.0 gem once release is made
15
- gem 'rspec-rails', '~> 4.0.0.beta3'
16
- gem 'sqlite3', '~> 1.4.0'
17
- else
18
- gem 'sqlite3', '~> 1.3.13'
19
- gem 'rspec-rails', '~> 3.1'
20
- end
12
+ appraise "rails_5.2" do
13
+ gem "railties", "~> 5.2"
14
+ end
21
15
 
22
- end
16
+ appraise "rails_6.0" do
17
+ gem "railties", "~> 6.0"
23
18
  end
data/Gemfile CHANGED
@@ -2,13 +2,17 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'addressable', '~> 2.6.0'
5
+ gem 'addressable'
6
6
  gem 'ammeter'
7
7
  gem 'appraisal'
8
- gem 'capybara', '>= 2.6.2'
9
- gem 'database_cleaner', '~> 1.0'
10
- gem 'factory_bot_rails', '~> 5.0'
11
- gem 'nokogiri', '~> 1.10.0'
8
+ gem 'capybara'
9
+ gem 'database_cleaner'
10
+ gem 'erb_lint', require: false
11
+ gem 'factory_bot_rails'
12
+ gem 'nokogiri'
12
13
  gem 'pry', require: false
13
- gem 'shoulda-matchers', '~> 4.1'
14
- gem 'timecop', '~> 0.6'
14
+ gem 'rails-controller-testing'
15
+ gem 'rspec-rails'
16
+ gem 'shoulda-matchers'
17
+ gem 'sqlite3'
18
+ gem 'timecop'
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clearance (2.1.0)
4
+ clearance (2.4.0)
5
5
  actionmailer (>= 5.0)
6
6
  activemodel (>= 5.0)
7
7
  activerecord (>= 5.0)
8
+ argon2 (~> 2.0, >= 2.0.2)
8
9
  bcrypt (>= 3.1.1)
9
10
  email_validator (~> 2.0)
10
11
  railties (>= 5.0)
@@ -12,52 +13,65 @@ PATH
12
13
  GEM
13
14
  remote: https://rubygems.org/
14
15
  specs:
15
- actionmailer (6.0.2.1)
16
- actionpack (= 6.0.2.1)
17
- actionview (= 6.0.2.1)
18
- activejob (= 6.0.2.1)
16
+ actionmailer (6.1.3)
17
+ actionpack (= 6.1.3)
18
+ actionview (= 6.1.3)
19
+ activejob (= 6.1.3)
20
+ activesupport (= 6.1.3)
19
21
  mail (~> 2.5, >= 2.5.4)
20
22
  rails-dom-testing (~> 2.0)
21
- actionpack (6.0.2.1)
22
- actionview (= 6.0.2.1)
23
- activesupport (= 6.0.2.1)
24
- rack (~> 2.0, >= 2.0.8)
23
+ actionpack (6.1.3)
24
+ actionview (= 6.1.3)
25
+ activesupport (= 6.1.3)
26
+ rack (~> 2.0, >= 2.0.9)
25
27
  rack-test (>= 0.6.3)
26
28
  rails-dom-testing (~> 2.0)
27
29
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
28
- actionview (6.0.2.1)
29
- activesupport (= 6.0.2.1)
30
+ actionview (6.1.3)
31
+ activesupport (= 6.1.3)
30
32
  builder (~> 3.1)
31
33
  erubi (~> 1.4)
32
34
  rails-dom-testing (~> 2.0)
33
35
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
34
- activejob (6.0.2.1)
35
- activesupport (= 6.0.2.1)
36
+ activejob (6.1.3)
37
+ activesupport (= 6.1.3)
36
38
  globalid (>= 0.3.6)
37
- activemodel (6.0.2.1)
38
- activesupport (= 6.0.2.1)
39
- activerecord (6.0.2.1)
40
- activemodel (= 6.0.2.1)
41
- activesupport (= 6.0.2.1)
42
- activesupport (6.0.2.1)
39
+ activemodel (6.1.3)
40
+ activesupport (= 6.1.3)
41
+ activerecord (6.1.3)
42
+ activemodel (= 6.1.3)
43
+ activesupport (= 6.1.3)
44
+ activesupport (6.1.3)
43
45
  concurrent-ruby (~> 1.0, >= 1.0.2)
44
- i18n (>= 0.7, < 2)
45
- minitest (~> 5.1)
46
- tzinfo (~> 1.1)
47
- zeitwerk (~> 2.2)
48
- addressable (2.6.0)
49
- public_suffix (>= 2.0.2, < 4.0)
46
+ i18n (>= 1.6, < 2)
47
+ minitest (>= 5.1)
48
+ tzinfo (~> 2.0)
49
+ zeitwerk (~> 2.3)
50
+ addressable (2.7.0)
51
+ public_suffix (>= 2.0.2, < 5.0)
50
52
  ammeter (1.1.4)
51
53
  activesupport (>= 3.0)
52
54
  railties (>= 3.0)
53
55
  rspec-rails (>= 2.2)
54
- appraisal (2.2.0)
56
+ appraisal (2.3.0)
55
57
  bundler
56
58
  rake
57
59
  thor (>= 0.14.0)
58
- bcrypt (3.1.13)
60
+ argon2 (2.0.3)
61
+ ffi (~> 1.14)
62
+ ffi-compiler (~> 1.0)
63
+ ast (2.4.2)
64
+ bcrypt (3.1.16)
65
+ better_html (1.0.16)
66
+ actionview (>= 4.0)
67
+ activesupport (>= 4.0)
68
+ ast (~> 2.0)
69
+ erubi (~> 1.4)
70
+ html_tokenizer (~> 0.0.6)
71
+ parser (>= 2.4)
72
+ smart_properties
59
73
  builder (3.2.4)
60
- capybara (3.29.0)
74
+ capybara (3.33.0)
61
75
  addressable
62
76
  mini_mime (>= 0.1.3)
63
77
  nokogiri (~> 1.8)
@@ -65,97 +79,138 @@ GEM
65
79
  rack-test (>= 0.6.3)
66
80
  regexp_parser (~> 1.5)
67
81
  xpath (~> 3.2)
68
- coderay (1.1.2)
69
- concurrent-ruby (1.1.5)
70
- crass (1.0.5)
71
- database_cleaner (1.7.0)
72
- diff-lcs (1.3)
73
- email_validator (2.0.1)
82
+ coderay (1.1.3)
83
+ concurrent-ruby (1.1.8)
84
+ crass (1.0.6)
85
+ database_cleaner (1.8.5)
86
+ diff-lcs (1.4.4)
87
+ email_validator (2.2.2)
74
88
  activemodel
75
- erubi (1.9.0)
76
- factory_bot (5.1.1)
77
- activesupport (>= 4.2.0)
78
- factory_bot_rails (5.1.1)
79
- factory_bot (~> 5.1.0)
80
- railties (>= 4.2.0)
89
+ erb_lint (0.0.34)
90
+ activesupport
91
+ better_html (~> 1.0.7)
92
+ html_tokenizer
93
+ rainbow
94
+ rubocop (~> 0.79)
95
+ smart_properties
96
+ erubi (1.10.0)
97
+ factory_bot (6.1.0)
98
+ activesupport (>= 5.0.0)
99
+ factory_bot_rails (6.1.0)
100
+ factory_bot (~> 6.1.0)
101
+ railties (>= 5.0.0)
102
+ ffi (1.14.2)
103
+ ffi-compiler (1.0.1)
104
+ ffi (>= 1.0.0)
105
+ rake
81
106
  globalid (0.4.2)
82
107
  activesupport (>= 4.2.0)
83
- i18n (1.7.0)
108
+ html_tokenizer (0.0.7)
109
+ i18n (1.8.9)
84
110
  concurrent-ruby (~> 1.0)
85
- loofah (2.4.0)
111
+ loofah (2.9.0)
86
112
  crass (~> 1.0.2)
87
113
  nokogiri (>= 1.5.9)
88
114
  mail (2.7.1)
89
115
  mini_mime (>= 0.1.1)
90
- method_source (0.9.2)
116
+ method_source (1.0.0)
91
117
  mini_mime (1.0.2)
92
- mini_portile2 (2.4.0)
93
- minitest (5.13.0)
94
- nokogiri (1.10.7)
95
- mini_portile2 (~> 2.4.0)
96
- pry (0.12.2)
97
- coderay (~> 1.1.0)
98
- method_source (~> 0.9.0)
99
- public_suffix (3.1.1)
100
- rack (2.0.8)
118
+ mini_portile2 (2.5.0)
119
+ minitest (5.14.4)
120
+ nokogiri (1.11.1)
121
+ mini_portile2 (~> 2.5.0)
122
+ racc (~> 1.4)
123
+ parallel (1.19.2)
124
+ parser (3.0.0.0)
125
+ ast (~> 2.4.1)
126
+ pry (0.13.1)
127
+ coderay (~> 1.1)
128
+ method_source (~> 1.0)
129
+ public_suffix (4.0.5)
130
+ racc (1.5.2)
131
+ rack (2.2.3)
101
132
  rack-test (1.1.0)
102
133
  rack (>= 1.0, < 3)
134
+ rails-controller-testing (1.0.5)
135
+ actionpack (>= 5.0.1.rc1)
136
+ actionview (>= 5.0.1.rc1)
137
+ activesupport (>= 5.0.1.rc1)
103
138
  rails-dom-testing (2.0.3)
104
139
  activesupport (>= 4.2.0)
105
140
  nokogiri (>= 1.6)
106
141
  rails-html-sanitizer (1.3.0)
107
142
  loofah (~> 2.3)
108
- railties (6.0.2.1)
109
- actionpack (= 6.0.2.1)
110
- activesupport (= 6.0.2.1)
143
+ railties (6.1.3)
144
+ actionpack (= 6.1.3)
145
+ activesupport (= 6.1.3)
111
146
  method_source
112
147
  rake (>= 0.8.7)
113
- thor (>= 0.20.3, < 2.0)
114
- rake (13.0.1)
115
- regexp_parser (1.6.0)
116
- rspec-core (3.9.0)
117
- rspec-support (~> 3.9.0)
118
- rspec-expectations (3.9.0)
148
+ thor (~> 1.0)
149
+ rainbow (3.0.0)
150
+ rake (13.0.3)
151
+ regexp_parser (1.7.1)
152
+ rexml (3.2.4)
153
+ rspec-core (3.9.2)
154
+ rspec-support (~> 3.9.3)
155
+ rspec-expectations (3.9.2)
119
156
  diff-lcs (>= 1.2.0, < 2.0)
120
157
  rspec-support (~> 3.9.0)
121
- rspec-mocks (3.9.0)
158
+ rspec-mocks (3.9.1)
122
159
  diff-lcs (>= 1.2.0, < 2.0)
123
160
  rspec-support (~> 3.9.0)
124
- rspec-rails (3.9.0)
125
- actionpack (>= 3.0)
126
- activesupport (>= 3.0)
127
- railties (>= 3.0)
128
- rspec-core (~> 3.9.0)
129
- rspec-expectations (~> 3.9.0)
130
- rspec-mocks (~> 3.9.0)
131
- rspec-support (~> 3.9.0)
132
- rspec-support (3.9.0)
133
- shoulda-matchers (4.1.2)
161
+ rspec-rails (4.0.1)
162
+ actionpack (>= 4.2)
163
+ activesupport (>= 4.2)
164
+ railties (>= 4.2)
165
+ rspec-core (~> 3.9)
166
+ rspec-expectations (~> 3.9)
167
+ rspec-mocks (~> 3.9)
168
+ rspec-support (~> 3.9)
169
+ rspec-support (3.9.3)
170
+ rubocop (0.88.0)
171
+ parallel (~> 1.10)
172
+ parser (>= 2.7.1.1)
173
+ rainbow (>= 2.2.2, < 4.0)
174
+ regexp_parser (>= 1.7)
175
+ rexml
176
+ rubocop-ast (>= 0.1.0, < 1.0)
177
+ ruby-progressbar (~> 1.7)
178
+ unicode-display_width (>= 1.4.0, < 2.0)
179
+ rubocop-ast (0.3.0)
180
+ parser (>= 2.7.1.4)
181
+ ruby-progressbar (1.10.1)
182
+ shoulda-matchers (4.3.0)
134
183
  activesupport (>= 4.2.0)
135
- thor (1.0.1)
136
- thread_safe (0.3.6)
184
+ smart_properties (1.15.0)
185
+ sqlite3 (1.4.2)
186
+ thor (1.1.0)
137
187
  timecop (0.9.1)
138
- tzinfo (1.2.5)
139
- thread_safe (~> 0.1)
188
+ tzinfo (2.0.4)
189
+ concurrent-ruby (~> 1.0)
190
+ unicode-display_width (1.7.0)
140
191
  xpath (3.2.0)
141
192
  nokogiri (~> 1.8)
142
- zeitwerk (2.2.2)
193
+ zeitwerk (2.4.2)
143
194
 
144
195
  PLATFORMS
145
196
  ruby
146
197
 
147
198
  DEPENDENCIES
148
- addressable (~> 2.6.0)
199
+ addressable
149
200
  ammeter
150
201
  appraisal
151
- capybara (>= 2.6.2)
202
+ capybara
152
203
  clearance!
153
- database_cleaner (~> 1.0)
154
- factory_bot_rails (~> 5.0)
155
- nokogiri (~> 1.10.0)
204
+ database_cleaner
205
+ erb_lint
206
+ factory_bot_rails
207
+ nokogiri
156
208
  pry
157
- shoulda-matchers (~> 4.1)
158
- timecop (~> 0.6)
209
+ rails-controller-testing
210
+ rspec-rails
211
+ shoulda-matchers
212
+ sqlite3
213
+ timecop
159
214
 
160
215
  BUNDLED WITH
161
- 1.17.3
216
+ 2.1.4
data/NEWS.md CHANGED
@@ -3,6 +3,68 @@
3
3
  The noteworthy changes for each Clearance version are included here. For a
4
4
  complete changelog, see the git history for each version via the version links.
5
5
 
6
+ ## [2.4.0] - March 5, 2021
7
+
8
+ ### Added
9
+
10
+ - Optionally use signed cookies to prevent remember token timing attacks
11
+
12
+ [2.4.0]: https://github.com/thoughtbot/clearance/compare/v2.3.1...v2.4.0
13
+
14
+ ## [2.3.1] - March 5, 2021
15
+
16
+ ### Fixed
17
+
18
+ - Support for accessing Rails 6.x primary_key_type in generator.
19
+ - Fix password reset URLs when using a custom model
20
+ - Fix flaky test that relied on too specific time delta
21
+ - Revert case sensitivity for email uniqueness
22
+ - Bump nokogiri and actionview dependencies to address security vulnerabilities
23
+
24
+ [2.3.1]: https://github.com/thoughtbot/clearance/compare/v2.3.0...v2.3.1
25
+
26
+ ## [2.3.0] - August 14, 2020
27
+
28
+ ### Fixed
29
+
30
+ - Delete cookie correctly when a callable object is set as the custom domain
31
+ setting.
32
+ - Strip `as` parameter when signing in through the back door.
33
+ - Remove broken autoload for deprecated password strategies.
34
+
35
+ ### Changed
36
+
37
+ - Deliver password reset email inline rather than in the background.
38
+ - Remove unnecessary unsafe interpolation in erb templates.
39
+
40
+ [2.3.0]: https://github.com/thoughtbot/clearance/compare/v2.2.0...v2.3.0
41
+
42
+ ## [2.2.1] - August 7, 2020
43
+
44
+ ### Fixed
45
+
46
+ - Prevent user enumeration by timing attacks. Trying to log in with an
47
+ unrecognized email address will now take the same amount of time as for a user
48
+ that does exist in the system.
49
+
50
+ [2.2.1]: https://github.com/thoughtbot/clearance/compare/v2.2.0...v2.2.1
51
+
52
+ ## [2.2.0] - July 9, 2020
53
+
54
+ ### Added
55
+
56
+ - Add an Argon2 password strategy
57
+
58
+ ### Fixed
59
+
60
+ - Use strings instead of classes on guard classes, avoids Rails deprecation
61
+ warning.
62
+ - Use `find_by` style for finders, improves neo4j support
63
+ - Provide explicit case sensitivity option for email uniqueness, avoid Rails
64
+ deprecation warning.
65
+
66
+ [2.2.0]: https://github.com/thoughtbot/clearance/compare/v2.1.0...v2.2.0
67
+
6
68
  ## [2.1.0] - December 19, 2019
7
69
 
8
70
  ### Added