clearance 2.6.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +5 -1
- data/Appraisals +7 -3
- data/CHANGELOG.md +21 -1
- data/CODEOWNERS +1 -0
- data/Gemfile.lock +19 -22
- data/README.md +5 -1
- data/RELEASING.md +2 -2
- data/app/controllers/clearance/users_controller.rb +1 -1
- data/bin/setup +2 -1
- data/gemfiles/rails_6.0.gemfile +1 -1
- data/gemfiles/rails_6.1.gemfile +1 -1
- data/gemfiles/rails_7.0.gemfile +1 -1
- data/gemfiles/rails_7.1.gemfile +21 -0
- data/lib/clearance/authentication.rb +6 -1
- data/lib/clearance/back_door.rb +1 -1
- data/lib/clearance/session.rb +2 -4
- data/lib/clearance/testing/deny_access_matcher.rb +1 -1
- data/lib/clearance/token.rb +3 -3
- data/lib/clearance/version.rb +1 -1
- data/spec/clearance/session_spec.rb +2 -1
- data/spec/dummy/application.rb +0 -6
- data/spec/requests/cookie_options_spec.rb +1 -1
- data/spec/support/cookies.rb +1 -1
- data/spec/support/request_with_remember_token.rb +2 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 830820687a4cbb2e63c535692a8bbc1bfee75f747ef351362df0142317251e56
|
|
4
|
+
data.tar.gz: 559bc151b6cf7669f13c113c16e4275dbd687fe4c3daf77bb17e288bd982548e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d68f58f9428536f29d68348baaa4e616bd39f713933e986bff2977f5afce6d1fdf42a783f475de869d564a384b1414e737b2e34e63bf8bdb35dee53a1e234bf6
|
|
7
|
+
data.tar.gz: 26f780a332edc0358289d87e924749078366d08e9490574e7a5943a61abbe19f16a4cd13dc947f10bddf6733aff3c405aa2e94e33787dd618b9218dd3cc334cb
|
data/.github/workflows/tests.yml
CHANGED
|
@@ -19,10 +19,12 @@ jobs:
|
|
|
19
19
|
- "6.0"
|
|
20
20
|
- "6.1"
|
|
21
21
|
- "7.0"
|
|
22
|
+
- "7.1"
|
|
22
23
|
ruby:
|
|
23
24
|
- "2.7.6"
|
|
24
25
|
- "3.0.4"
|
|
25
26
|
- "3.1.2"
|
|
27
|
+
- "3.2.2"
|
|
26
28
|
|
|
27
29
|
env:
|
|
28
30
|
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.gemfile }}.gemfile
|
|
@@ -38,7 +40,9 @@ jobs:
|
|
|
38
40
|
bundler-cache: true
|
|
39
41
|
|
|
40
42
|
- name: "Reset app database"
|
|
41
|
-
run:
|
|
43
|
+
run: |
|
|
44
|
+
bundle exec rake dummy:db:drop
|
|
45
|
+
bundle exec rake dummy:db:setup
|
|
42
46
|
|
|
43
47
|
- name: "Run tests"
|
|
44
48
|
run: bundle exec rake
|
data/Appraisals
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
appraise "rails_6.0" do
|
|
2
|
-
gem "railties", "~> 6.0"
|
|
2
|
+
gem "railties", "~> 6.0.0"
|
|
3
3
|
gem "net-smtp", require: false # not bundled in ruby 3.1
|
|
4
4
|
gem "psych", "< 4" # psych 4 switched from unsafe load to safe load
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
appraise "rails_6.1" do
|
|
8
|
-
gem "railties", "~> 6.1"
|
|
8
|
+
gem "railties", "~> 6.1.0"
|
|
9
9
|
gem "net-smtp", require: false # not bundled in ruby 3.1
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
appraise "rails_7.0" do
|
|
13
|
-
gem "railties", "~> 7.0"
|
|
13
|
+
gem "railties", "~> 7.0.0"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
appraise "rails_7.1" do
|
|
17
|
+
gem "railties", "~> 7.1.0"
|
|
14
18
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,27 @@ complete changelog, see the git history for each version via the version links.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
-
[Unreleased]: https://github.com/thoughtbot/clearance/compare/v2.6.
|
|
8
|
+
[Unreleased]: https://github.com/thoughtbot/clearance/compare/v2.6.2...main
|
|
9
|
+
|
|
10
|
+
## [2.6.2] January 15, 2024
|
|
11
|
+
- Fix typo in Clearance::Token docs (#1000) Gabe Berke-Williams
|
|
12
|
+
- Add CODEOWNERS file (#994)
|
|
13
|
+
- Add support for Rails 7.1 (#995) Samuel Giddens
|
|
14
|
+
- Fix for setup & CI for Rails 7.1 support, update "MiniTest" to "Minitest",
|
|
15
|
+
add handling for different versions of Rack::Utils.set_cookie_header!, remove
|
|
16
|
+
deprecated active record handling in application.rb (#998)
|
|
17
|
+
- Update argon2 to v2.2.0 (#989) Georg Leciejewski
|
|
18
|
+
- Prefer literal hash creation notation (#984) Ivan Marynych
|
|
19
|
+
- Add Ruby 3.2.2 to testing matrix (#991)
|
|
20
|
+
- Replace mentions of NEWS.md with CHANGELOG.md (#982)
|
|
21
|
+
- Fix broken thoughtbot logo on README.md
|
|
22
|
+
|
|
23
|
+
## [2.6.1] - September 23, 2022
|
|
24
|
+
- Document how to report security issues
|
|
25
|
+
- Only update the `env["QUERY_STRING"]` if the `as` parameter is present in
|
|
26
|
+
backdoor middleware
|
|
27
|
+
|
|
28
|
+
[2.6.1]: https://github.com/thoughtbot/clearance/compare/v2.6.0...v2.6.1
|
|
9
29
|
|
|
10
30
|
## [2.6.0] - June 12, 2022
|
|
11
31
|
|
data/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @sej3506
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
clearance (2.
|
|
4
|
+
clearance (2.6.2)
|
|
5
5
|
actionmailer (>= 5.0)
|
|
6
6
|
activemodel (>= 5.0)
|
|
7
7
|
activerecord (>= 5.0)
|
|
@@ -59,11 +59,11 @@ GEM
|
|
|
59
59
|
bundler
|
|
60
60
|
rake
|
|
61
61
|
thor (>= 0.14.0)
|
|
62
|
-
argon2 (2.
|
|
63
|
-
ffi (~> 1.
|
|
62
|
+
argon2 (2.3.0)
|
|
63
|
+
ffi (~> 1.15)
|
|
64
64
|
ffi-compiler (~> 1.0)
|
|
65
65
|
ast (2.4.2)
|
|
66
|
-
bcrypt (3.1.
|
|
66
|
+
bcrypt (3.1.20)
|
|
67
67
|
better_html (1.0.16)
|
|
68
68
|
actionview (>= 4.0)
|
|
69
69
|
activesupport (>= 4.0)
|
|
@@ -91,9 +91,9 @@ GEM
|
|
|
91
91
|
activerecord (>= 5.a)
|
|
92
92
|
database_cleaner-core (~> 2.0.0)
|
|
93
93
|
database_cleaner-core (2.0.1)
|
|
94
|
+
date (3.3.4)
|
|
94
95
|
diff-lcs (1.5.0)
|
|
95
|
-
|
|
96
|
-
email_validator (2.2.3)
|
|
96
|
+
email_validator (2.2.4)
|
|
97
97
|
activemodel
|
|
98
98
|
erb_lint (0.1.1)
|
|
99
99
|
activesupport
|
|
@@ -109,39 +109,37 @@ GEM
|
|
|
109
109
|
factory_bot_rails (6.2.0)
|
|
110
110
|
factory_bot (~> 6.2.0)
|
|
111
111
|
railties (>= 5.0.0)
|
|
112
|
-
ffi (1.
|
|
112
|
+
ffi (1.16.3)
|
|
113
113
|
ffi-compiler (1.0.1)
|
|
114
114
|
ffi (>= 1.0.0)
|
|
115
115
|
rake
|
|
116
|
-
globalid (1.
|
|
117
|
-
activesupport (>=
|
|
116
|
+
globalid (1.2.1)
|
|
117
|
+
activesupport (>= 6.1)
|
|
118
118
|
html_tokenizer (0.0.7)
|
|
119
119
|
i18n (1.10.0)
|
|
120
120
|
concurrent-ruby (~> 1.0)
|
|
121
121
|
loofah (2.18.0)
|
|
122
122
|
crass (~> 1.0.2)
|
|
123
123
|
nokogiri (>= 1.5.9)
|
|
124
|
-
mail (2.
|
|
124
|
+
mail (2.8.1)
|
|
125
125
|
mini_mime (>= 0.1.1)
|
|
126
|
+
net-imap
|
|
127
|
+
net-pop
|
|
128
|
+
net-smtp
|
|
126
129
|
matrix (0.4.2)
|
|
127
130
|
method_source (1.0.0)
|
|
128
131
|
mini_mime (1.1.2)
|
|
129
132
|
mini_portile2 (2.8.0)
|
|
130
133
|
minitest (5.15.0)
|
|
131
|
-
net-imap (0.
|
|
132
|
-
|
|
134
|
+
net-imap (0.4.9)
|
|
135
|
+
date
|
|
133
136
|
net-protocol
|
|
134
|
-
|
|
135
|
-
net-pop (0.1.1)
|
|
136
|
-
digest
|
|
137
|
+
net-pop (0.1.2)
|
|
137
138
|
net-protocol
|
|
139
|
+
net-protocol (0.2.2)
|
|
138
140
|
timeout
|
|
139
|
-
net-
|
|
140
|
-
timeout
|
|
141
|
-
net-smtp (0.3.1)
|
|
142
|
-
digest
|
|
141
|
+
net-smtp (0.4.0)
|
|
143
142
|
net-protocol
|
|
144
|
-
timeout
|
|
145
143
|
nokogiri (1.13.6)
|
|
146
144
|
mini_portile2 (~> 2.8.0)
|
|
147
145
|
racc (~> 1.4)
|
|
@@ -209,10 +207,9 @@ GEM
|
|
|
209
207
|
activesupport (>= 5.2.0)
|
|
210
208
|
smart_properties (1.17.0)
|
|
211
209
|
sqlite3 (1.4.2)
|
|
212
|
-
strscan (3.0.3)
|
|
213
210
|
thor (1.2.1)
|
|
214
211
|
timecop (0.9.5)
|
|
215
|
-
timeout (0.
|
|
212
|
+
timeout (0.4.1)
|
|
216
213
|
tzinfo (2.0.4)
|
|
217
214
|
concurrent-ruby (~> 1.0)
|
|
218
215
|
unicode-display_width (2.1.0)
|
data/README.md
CHANGED
|
@@ -475,6 +475,10 @@ Thank you, [contributors]!
|
|
|
475
475
|
[CONTRIBUTING.md]: /CONTRIBUTING.md
|
|
476
476
|
[contributors]: https://github.com/thoughtbot/clearance/graphs/contributors
|
|
477
477
|
|
|
478
|
+
## Security
|
|
479
|
+
|
|
480
|
+
For security issues it's better to contact <security@thoughtbot.com> (See <https://thoughtbot.com/security>)
|
|
481
|
+
|
|
478
482
|
## License
|
|
479
483
|
|
|
480
484
|
Clearance is copyright © 2009-2019 thoughtbot. It is free software, and may be
|
|
@@ -484,7 +488,7 @@ redistributed under the terms specified in the [`LICENSE`] file.
|
|
|
484
488
|
|
|
485
489
|
## About thoughtbot
|
|
486
490
|
|
|
487
|
-

|
|
488
492
|
|
|
489
493
|
Clearance is maintained and funded by thoughtbot, inc.
|
|
490
494
|
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
data/RELEASING.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
1. Update version file accordingly.
|
|
4
4
|
1. Run `bundle install` to update Gemfile.lock
|
|
5
|
-
1. Update `
|
|
5
|
+
1. Update `CHANGELOG.md` to reflect the changes since last release.
|
|
6
6
|
1. Commit changes.
|
|
7
7
|
There shouldn't be code changes,
|
|
8
8
|
and thus CI doesn't need to run,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
gem build clearance.gemspec
|
|
17
17
|
gem push clearance-*.gem
|
|
18
18
|
```
|
|
19
|
-
1. Add a new GitHub release using the recent `
|
|
19
|
+
1. Add a new GitHub release using the recent `CHANGELOG.md` as the content. Sample
|
|
20
20
|
URL: https://github.com/thoughtbot/clearance/releases/new?tag=vVERSION
|
|
21
21
|
1. Announce the new release,
|
|
22
22
|
making sure to say "thank you" to the contributors
|
data/bin/setup
CHANGED
data/gemfiles/rails_6.0.gemfile
CHANGED
data/gemfiles/rails_6.1.gemfile
CHANGED
data/gemfiles/rails_7.0.gemfile
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "addressable"
|
|
6
|
+
gem "ammeter"
|
|
7
|
+
gem "appraisal"
|
|
8
|
+
gem "capybara"
|
|
9
|
+
gem "database_cleaner"
|
|
10
|
+
gem "erb_lint", require: false
|
|
11
|
+
gem "factory_bot_rails"
|
|
12
|
+
gem "nokogiri"
|
|
13
|
+
gem "pry", require: false
|
|
14
|
+
gem "rails-controller-testing"
|
|
15
|
+
gem "rspec-rails"
|
|
16
|
+
gem "shoulda-matchers"
|
|
17
|
+
gem "sqlite3"
|
|
18
|
+
gem "timecop"
|
|
19
|
+
gem "railties", "~> 7.1.0"
|
|
20
|
+
|
|
21
|
+
gemspec path: "../"
|
|
@@ -66,7 +66,12 @@ module Clearance
|
|
|
66
66
|
clearance_session.sign_in(user, &block)
|
|
67
67
|
|
|
68
68
|
if signed_in? && Clearance.configuration.rotate_csrf_on_sign_in?
|
|
69
|
-
|
|
69
|
+
if request.respond_to?(:reset_csrf_token)
|
|
70
|
+
# Rails 7.1+
|
|
71
|
+
request.reset_csrf_token
|
|
72
|
+
else
|
|
73
|
+
request.session.try(:delete, :_csrf_token)
|
|
74
|
+
end
|
|
70
75
|
form_authenticity_token
|
|
71
76
|
end
|
|
72
77
|
end
|
data/lib/clearance/back_door.rb
CHANGED
|
@@ -50,9 +50,9 @@ module Clearance
|
|
|
50
50
|
def sign_in_through_the_back_door(env)
|
|
51
51
|
params = Rack::Utils.parse_query(env["QUERY_STRING"])
|
|
52
52
|
user_param = params.delete("as")
|
|
53
|
-
env["QUERY_STRING"] = Rack::Utils.build_query(params)
|
|
54
53
|
|
|
55
54
|
if user_param.present?
|
|
55
|
+
env["QUERY_STRING"] = Rack::Utils.build_query(params)
|
|
56
56
|
user = find_user(user_param)
|
|
57
57
|
env[:clearance].sign_in(user)
|
|
58
58
|
end
|
data/lib/clearance/session.rb
CHANGED
|
@@ -185,10 +185,8 @@ module Clearance
|
|
|
185
185
|
|
|
186
186
|
# @api private
|
|
187
187
|
def delete_cookie_options
|
|
188
|
-
|
|
189
|
-
if configured_cookie_domain
|
|
190
|
-
options[:domain] = domain
|
|
191
|
-
end
|
|
188
|
+
{}.tap do |options|
|
|
189
|
+
options[:domain] = domain if configured_cookie_domain
|
|
192
190
|
end
|
|
193
191
|
end
|
|
194
192
|
|
|
@@ -90,7 +90,7 @@ module Clearance
|
|
|
90
90
|
@failure_message_when_negated <<
|
|
91
91
|
"Didn't expect to redirect to #{@url}."
|
|
92
92
|
true
|
|
93
|
-
rescue
|
|
93
|
+
rescue ::Minitest::Assertion, ::Test::Unit::AssertionFailedError
|
|
94
94
|
@failure_message << "Expected to redirect to #{@url} but did not."
|
|
95
95
|
false
|
|
96
96
|
end
|
data/lib/clearance/token.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module Clearance
|
|
2
2
|
# Random token used for password reset and remember tokens.
|
|
3
|
-
# Clearance tokens are also public API and are
|
|
4
|
-
# need a random token to correspond to a given user (e.g. you added an
|
|
5
|
-
# confirmation token).
|
|
3
|
+
# Clearance tokens are also public API and are intended to be used anywhere
|
|
4
|
+
# you need a random token to correspond to a given user (e.g. you added an
|
|
5
|
+
# email confirmation token).
|
|
6
6
|
class Token
|
|
7
7
|
# Generate a new random, 20 byte hex token.
|
|
8
8
|
#
|
data/lib/clearance/version.rb
CHANGED
data/spec/dummy/application.rb
CHANGED
|
@@ -19,12 +19,6 @@ module Dummy
|
|
|
19
19
|
config.paths["log"] = "tmp/log/development.log"
|
|
20
20
|
config.paths.add "config/routes.rb", with: "#{APP_ROOT}/config/routes.rb"
|
|
21
21
|
|
|
22
|
-
if Rails.version.match?(/^6.0/)
|
|
23
|
-
config.active_record.sqlite3.represent_boolean_as_integer = true
|
|
24
|
-
else
|
|
25
|
-
config.active_record.legacy_connection_handling = false
|
|
26
|
-
end
|
|
27
|
-
|
|
28
22
|
def require_environment!
|
|
29
23
|
initialize!
|
|
30
24
|
end
|
|
@@ -40,7 +40,7 @@ describe "Cookie options" do
|
|
|
40
40
|
it { should_have_one_remember_token }
|
|
41
41
|
|
|
42
42
|
it "should have the httponly flag set" do
|
|
43
|
-
expect(remember_token_cookies.last).to match(/
|
|
43
|
+
expect(remember_token_cookies.last.downcase).to match(/httponly/)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
data/spec/support/cookies.rb
CHANGED
|
@@ -36,7 +36,7 @@ RSpec::Matchers.define :set_cookie do |name, expected_value, expected_expires_at
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def extract_cookies
|
|
39
|
-
@cookie_headers = @headers[
|
|
39
|
+
@cookie_headers = @headers["Set-Cookie"] || @headers["set-cookie"] || []
|
|
40
40
|
@cookie_headers = [@cookie_headers] if @cookie_headers.respond_to?(:to_str)
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -16,7 +16,8 @@ module RememberTokenHelpers
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def remember_token_cookies
|
|
19
|
-
|
|
19
|
+
set_cookie_header = headers["Set-Cookie"] || headers["set-cookie"]
|
|
20
|
+
cookie_lines = Array(set_cookie_header).join("\n").lines.map(&:chomp)
|
|
20
21
|
cookie_lines.select { |name| name =~ /^remember_token/ }
|
|
21
22
|
end
|
|
22
23
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: clearance
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.6.
|
|
4
|
+
version: 2.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Croak
|
|
@@ -26,7 +26,7 @@ authors:
|
|
|
26
26
|
autorequire:
|
|
27
27
|
bindir: bin
|
|
28
28
|
cert_chain: []
|
|
29
|
-
date:
|
|
29
|
+
date: 2024-01-15 00:00:00.000000000 Z
|
|
30
30
|
dependencies:
|
|
31
31
|
- !ruby/object:Gem::Dependency
|
|
32
32
|
name: bcrypt
|
|
@@ -151,6 +151,7 @@ files:
|
|
|
151
151
|
- ".yardopts"
|
|
152
152
|
- Appraisals
|
|
153
153
|
- CHANGELOG.md
|
|
154
|
+
- CODEOWNERS
|
|
154
155
|
- CONTRIBUTING.md
|
|
155
156
|
- Gemfile
|
|
156
157
|
- Gemfile.lock
|
|
@@ -187,6 +188,7 @@ files:
|
|
|
187
188
|
- gemfiles/rails_6.0.gemfile
|
|
188
189
|
- gemfiles/rails_6.1.gemfile
|
|
189
190
|
- gemfiles/rails_7.0.gemfile
|
|
191
|
+
- gemfiles/rails_7.1.gemfile
|
|
190
192
|
- lib/clearance.rb
|
|
191
193
|
- lib/clearance/authentication.rb
|
|
192
194
|
- lib/clearance/authorization.rb
|