devise-argon2 2.0.2 → 2.0.4
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/test.yml +15 -47
- data/.gitignore +2 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +8 -7
- data/devise-argon2.gemspec +1 -1
- data/lib/devise-argon2/model.rb +5 -0
- data/lib/devise-argon2/version.rb +1 -1
- data/spec/devise-argon2_spec.rb +34 -0
- data/spec/rails_app/app/active_record/old_user.rb +1 -1
- data/spec/rails_app/app/active_record/user.rb +1 -1
- data/spec/rails_app/app/mongoid/old_user.rb +1 -1
- data/spec/rails_app/app/mongoid/user.rb +1 -1
- data/spec/rails_app/db/migrate/20250319085725_add_recoverable_fields_to_users.rb +6 -0
- data/spec/rails_app/db/migrate/20250319085738_add_recoverable_fields_to_old_users.rb +6 -0
- data/spec/rails_app/db/schema.rb +5 -2
- metadata +9 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b13e34bfd72f10cc708b067b1153dc9cb8b3aa9a904e47bc25c8d2a75acc7f62
|
|
4
|
+
data.tar.gz: 8f925ef0029619168d1d01bef19adb9769b503c8b68bc1b94997f222aa86c989
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 512b621099a74b85a1dd79ca5f9108cb9cf8105fd499b14c78c4d2fb6e1de2c8edbb8eabc3be94a5d783ef2f2dcb5d0a063bdeb9ddf8c1ffdbc27a3368c61027
|
|
7
|
+
data.tar.gz: 25e032a128c02cb60012f3e20654e049a84cec7cbebbcbbfe0f1588f71d6b63a9158b7b5ec1ceeb0c77b4e103c89f9fca9d4d38e0c21029228e06e03c7483356
|
data/.github/workflows/test.yml
CHANGED
|
@@ -7,68 +7,36 @@ jobs:
|
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
strategy:
|
|
9
9
|
matrix:
|
|
10
|
-
ruby-version: ['
|
|
11
|
-
rails-version: ['~>
|
|
10
|
+
ruby-version: ['3.1', '3.2', '3.3', '3.4']
|
|
11
|
+
rails-version: ['~> 7.2', '~> 8.0', '~> 8.1']
|
|
12
12
|
argon2-version: ['2.2', '2.3']
|
|
13
|
+
devise-version: ['~> 4.9', 'main']
|
|
13
14
|
orm:
|
|
14
15
|
- adapter: active_record
|
|
15
16
|
- adapter: mongoid
|
|
16
|
-
mongoid-version: 9.0.
|
|
17
|
+
mongoid-version: 9.0.3
|
|
17
18
|
- adapter: mongoid
|
|
18
|
-
mongoid-version: 8.1.
|
|
19
|
-
- adapter: mongoid
|
|
20
|
-
mongoid-version: 8.0.8
|
|
21
|
-
- adapter: mongoid
|
|
22
|
-
mongoid-version: 7.5.4
|
|
19
|
+
mongoid-version: 8.1.7
|
|
23
20
|
exclude:
|
|
24
|
-
- rails-version: '~>
|
|
25
|
-
ruby-version: '
|
|
26
|
-
- rails-version: '~>
|
|
27
|
-
ruby-version: '3.0'
|
|
28
|
-
- rails-version: '8.0.0.beta1'
|
|
29
|
-
ruby-version: '2.7'
|
|
30
|
-
- rails-version: '8.0.0.beta1'
|
|
31
|
-
ruby-version: '3.0'
|
|
32
|
-
- rails-version: '8.0.0.beta1'
|
|
21
|
+
- rails-version: '~> 8.1'
|
|
22
|
+
ruby-version: '3.1'
|
|
23
|
+
- rails-version: '~> 8.0'
|
|
33
24
|
ruby-version: '3.1'
|
|
34
25
|
- orm:
|
|
35
26
|
adapter: mongoid
|
|
36
|
-
rails-version: '8.
|
|
37
|
-
- orm:
|
|
38
|
-
adapter: mongoid
|
|
39
|
-
mongoid-version: 8.0.8
|
|
40
|
-
ruby-version: '3.3'
|
|
41
|
-
- orm:
|
|
42
|
-
adapter: mongoid
|
|
43
|
-
mongoid-version: 8.0.8
|
|
44
|
-
ruby-version: '3.2'
|
|
45
|
-
- orm:
|
|
46
|
-
adapter: mongoid
|
|
47
|
-
mongoid-version: 7.5.4
|
|
48
|
-
ruby-version: '3.3'
|
|
49
|
-
- orm:
|
|
50
|
-
adapter: mongoid
|
|
51
|
-
mongoid-version: 7.5.4
|
|
52
|
-
ruby-version: '3.2'
|
|
53
|
-
- orm:
|
|
54
|
-
adapter: mongoid
|
|
55
|
-
mongoid-version: 8.0.8
|
|
56
|
-
rails-version: '~> 7.2'
|
|
57
|
-
- orm:
|
|
58
|
-
adapter: mongoid
|
|
59
|
-
mongoid-version: 7.5.4
|
|
60
|
-
rails-version: '~> 7.2'
|
|
61
|
-
- orm:
|
|
62
|
-
adapter: mongoid
|
|
63
|
-
mongoid-version: 7.5.4
|
|
64
|
-
rails-version: '~> 7.1'
|
|
27
|
+
rails-version: '~> 8.1'
|
|
65
28
|
env:
|
|
66
|
-
RAILS_VERSION: ${{ matrix.rails-version || '~>
|
|
29
|
+
RAILS_VERSION: ${{ matrix.rails-version || '~> 8.0'}}
|
|
67
30
|
MONGOID_VERSION: ${{ matrix.orm.mongoid-version || '8.1.6'}}
|
|
68
31
|
ORM: ${{ matrix.orm.adapter }}
|
|
69
32
|
ARGON2_VERSION: ${{ matrix.argon2-version }}
|
|
70
33
|
DEVISE_VERSION: ${{ matrix.devise-version || '~> 4.9' }}
|
|
71
34
|
steps:
|
|
35
|
+
- name: Login to Docker Hub
|
|
36
|
+
uses: docker/login-action@v3
|
|
37
|
+
with:
|
|
38
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
39
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
72
40
|
- uses: actions/checkout@v4
|
|
73
41
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
74
42
|
uses: ruby/setup-ruby@v1
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -5,16 +5,17 @@ gemspec
|
|
|
5
5
|
gem 'rspec'
|
|
6
6
|
gem 'simplecov'
|
|
7
7
|
gem 'activerecord'
|
|
8
|
-
gem 'rails', ENV['RAILS_VERSION'] || '~>
|
|
8
|
+
gem 'rails', ENV['RAILS_VERSION'] || '~> 8.0'
|
|
9
9
|
gem 'argon2', ENV['ARGON2_VERSION'] || '~> 2.3'
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
if ENV['DEVISE_VERSION'] == 'main'
|
|
12
|
+
gem 'devise', github: 'heartcombo/devise'
|
|
13
|
+
else
|
|
14
|
+
gem 'devise', ENV['DEVISE_VERSION'] || '~> 4.9'
|
|
15
|
+
end
|
|
11
16
|
|
|
12
17
|
if ENV['ORM'] == 'mongoid'
|
|
13
18
|
gem 'mongoid', ENV['MONGOID_VERSION'] || '~> 7.5'
|
|
14
19
|
end
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
gem 'sqlite3', '~> 2.1'
|
|
18
|
-
else
|
|
19
|
-
gem 'sqlite3', '~> 1.6', '>= 1.6.6'
|
|
20
|
-
end
|
|
21
|
+
gem 'sqlite3', '~> 2.8'
|
data/devise-argon2.gemspec
CHANGED
data/lib/devise-argon2/model.rb
CHANGED
data/spec/devise-argon2_spec.rb
CHANGED
|
@@ -302,4 +302,38 @@ describe Devise::Models::Argon2 do
|
|
|
302
302
|
)
|
|
303
303
|
end
|
|
304
304
|
end
|
|
305
|
+
|
|
306
|
+
describe 'password reset' do
|
|
307
|
+
NEW_PASSWORD = 'new password'
|
|
308
|
+
|
|
309
|
+
shared_examples 'ways of resetting the password' do
|
|
310
|
+
it 'can be done via password_reset' do
|
|
311
|
+
user.reset_password(NEW_PASSWORD, NEW_PASSWORD)
|
|
312
|
+
expect(user.valid_password?(NEW_PASSWORD)).to be true
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
it 'can be done via password=' do
|
|
316
|
+
user.password = NEW_PASSWORD
|
|
317
|
+
expect(user.valid_password?(NEW_PASSWORD)).to be true
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
context 'encrypted_password is hashed with the current version of devise-argon2' do
|
|
322
|
+
include_examples 'ways of resetting the password'
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
context 'encrypted_password is hashed with version 1 of devise-argon2' do
|
|
326
|
+
let(:user) { OldUser.new(password: CORRECT_PASSWORD) }
|
|
327
|
+
|
|
328
|
+
before do
|
|
329
|
+
Devise.argon2_options.merge!({ migrate_from_devise_argon2_v1: true })
|
|
330
|
+
user.password_salt = 'devise-argon2 v1 salt'
|
|
331
|
+
user.encrypted_password = ::Argon2::Password.create(
|
|
332
|
+
"#{CORRECT_PASSWORD}#{user.password_salt}#{Devise.pepper}"
|
|
333
|
+
)
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
include_examples 'ways of resetting the password'
|
|
337
|
+
end
|
|
338
|
+
end
|
|
305
339
|
end
|
data/spec/rails_app/db/schema.rb
CHANGED
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
#
|
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
|
12
12
|
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
|
13
|
+
ActiveRecord::Schema.define(version: 2025_03_19_085738) do
|
|
14
14
|
create_table "old_users", force: :cascade do |t|
|
|
15
15
|
t.string "email", default: "", null: false
|
|
16
16
|
t.string "encrypted_password", default: "", null: false
|
|
17
17
|
t.string "password_salt"
|
|
18
18
|
t.datetime "created_at", null: false
|
|
19
19
|
t.datetime "updated_at", null: false
|
|
20
|
+
t.string "reset_password_token"
|
|
21
|
+
t.datetime "reset_password_sent_at"
|
|
20
22
|
t.index ["email"], name: "index_old_users_on_email", unique: true
|
|
21
23
|
end
|
|
22
24
|
|
|
@@ -25,7 +27,8 @@ ActiveRecord::Schema.define(version: 2023_10_04_084147) do
|
|
|
25
27
|
t.string "encrypted_password", default: "", null: false
|
|
26
28
|
t.datetime "created_at", null: false
|
|
27
29
|
t.datetime "updated_at", null: false
|
|
30
|
+
t.string "reset_password_token"
|
|
31
|
+
t.datetime "reset_password_sent_at"
|
|
28
32
|
t.index ["email"], name: "index_users_on_email", unique: true
|
|
29
33
|
end
|
|
30
|
-
|
|
31
34
|
end
|
metadata
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: devise-argon2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tamas Erdos
|
|
8
8
|
- Moritz Höppner
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: devise
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
16
|
requirements:
|
|
18
|
-
- - "
|
|
17
|
+
- - ">="
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
19
|
version: '4.0'
|
|
21
20
|
type: :runtime
|
|
22
21
|
prerelease: false
|
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
23
|
requirements:
|
|
25
|
-
- - "
|
|
24
|
+
- - ">="
|
|
26
25
|
- !ruby/object:Gem::Version
|
|
27
26
|
version: '4.0'
|
|
28
27
|
- !ruby/object:Gem::Dependency
|
|
@@ -81,6 +80,8 @@ files:
|
|
|
81
80
|
- spec/rails_app/config/routes.rb
|
|
82
81
|
- spec/rails_app/db/migrate/20230617201921_devise_create_users.rb
|
|
83
82
|
- spec/rails_app/db/migrate/20231004084147_devise_create_old_users.rb
|
|
83
|
+
- spec/rails_app/db/migrate/20250319085725_add_recoverable_fields_to_users.rb
|
|
84
|
+
- spec/rails_app/db/migrate/20250319085738_add_recoverable_fields_to_old_users.rb
|
|
84
85
|
- spec/rails_app/db/schema.rb
|
|
85
86
|
- spec/spec_helper.rb
|
|
86
87
|
homepage: https://github.com/erdostom/devise-argon2
|
|
@@ -103,8 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
103
104
|
- !ruby/object:Gem::Version
|
|
104
105
|
version: '0'
|
|
105
106
|
requirements: []
|
|
106
|
-
rubygems_version: 3.
|
|
107
|
-
signing_key:
|
|
107
|
+
rubygems_version: 3.6.9
|
|
108
108
|
specification_version: 4
|
|
109
109
|
summary: Enables Devise to hash passwords with Argon2id
|
|
110
110
|
test_files:
|
|
@@ -131,5 +131,7 @@ test_files:
|
|
|
131
131
|
- spec/rails_app/config/routes.rb
|
|
132
132
|
- spec/rails_app/db/migrate/20230617201921_devise_create_users.rb
|
|
133
133
|
- spec/rails_app/db/migrate/20231004084147_devise_create_old_users.rb
|
|
134
|
+
- spec/rails_app/db/migrate/20250319085725_add_recoverable_fields_to_users.rb
|
|
135
|
+
- spec/rails_app/db/migrate/20250319085738_add_recoverable_fields_to_old_users.rb
|
|
134
136
|
- spec/rails_app/db/schema.rb
|
|
135
137
|
- spec/spec_helper.rb
|