devise_security_extension 0.7.2 → 0.10.0
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 +7 -0
- data/.gitignore +39 -0
- data/.rubocop.yml +38 -0
- data/Gemfile +2 -15
- data/Gemfile.lock +157 -112
- data/README.md +264 -0
- data/Rakefile +13 -29
- data/app/controllers/devise/paranoid_verification_code_controller.rb +42 -0
- data/app/controllers/devise/password_expired_controller.rb +20 -7
- data/app/views/devise/paranoid_verification_code/show.html.erb +10 -0
- data/config/locales/de.yml +3 -0
- data/config/locales/en.yml +7 -4
- data/config/locales/it.yml +10 -0
- data/devise_security_extension.gemspec +24 -88
- data/lib/devise_security_extension/controllers/helpers.rb +40 -7
- data/lib/devise_security_extension/hooks/paranoid_verification.rb +5 -0
- data/lib/devise_security_extension/hooks/password_expirable.rb +1 -1
- data/lib/devise_security_extension/hooks/session_limitable.rb +3 -2
- data/lib/devise_security_extension/models/database_authenticatable_patch.rb +26 -0
- data/lib/devise_security_extension/models/expirable.rb +1 -2
- data/lib/devise_security_extension/models/old_password.rb +1 -2
- data/lib/devise_security_extension/models/paranoid_verification.rb +35 -0
- data/lib/devise_security_extension/models/password_archivable.rb +11 -11
- data/lib/devise_security_extension/models/password_expirable.rb +9 -5
- data/lib/devise_security_extension/models/secure_validatable.rb +35 -9
- data/lib/devise_security_extension/models/security_questionable.rb +4 -1
- data/lib/devise_security_extension/patches/confirmations_controller_captcha.rb +3 -1
- data/lib/devise_security_extension/patches/confirmations_controller_security_question.rb +3 -1
- data/lib/devise_security_extension/patches/passwords_controller_captcha.rb +3 -1
- data/lib/devise_security_extension/patches/passwords_controller_security_question.rb +3 -1
- data/lib/devise_security_extension/patches/registrations_controller_captcha.rb +11 -8
- data/lib/devise_security_extension/patches/sessions_controller_captcha.rb +8 -5
- data/lib/devise_security_extension/patches/unlocks_controller_captcha.rb +3 -1
- data/lib/devise_security_extension/patches/unlocks_controller_security_question.rb +3 -1
- data/lib/devise_security_extension/routes.rb +4 -0
- data/lib/devise_security_extension/version.rb +3 -0
- data/lib/devise_security_extension.rb +20 -10
- data/lib/generators/devise_security_extension/install_generator.rb +16 -33
- data/lib/generators/templates/devise_security_extension.rb +38 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/controllers/foos_controller.rb +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/user.rb +4 -0
- data/test/dummy/app/views/foos/index.html.erb +0 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/boot.rb +6 -0
- data/test/dummy/config/database.yml +7 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/test.rb +21 -0
- data/test/dummy/config/initializers/devise.rb +9 -0
- data/test/dummy/config/routes.rb +6 -0
- data/test/dummy/config/secrets.yml +3 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20120508165529_create_tables.rb +26 -0
- data/test/dummy/db/migrate/20150402165590_add_verification_columns.rb +11 -0
- data/test/dummy/db/migrate/20150407162345_add_verification_attempt_column.rb +9 -0
- data/test/test_helper.rb +10 -0
- data/test/test_install_generator.rb +16 -0
- data/test/test_paranoid_verification.rb +124 -0
- data/test/test_password_archivable.rb +61 -0
- data/test/test_password_expired_controller.rb +24 -0
- metadata +142 -62
- data/README.rdoc +0 -193
- data/VERSION +0 -1
- data/lib/devise_security_extension/models/security_question.rb +0 -3
- data/test/helper.rb +0 -17
- data/test/test_devise_security_extension.rb +0 -7
data/README.rdoc
DELETED
@@ -1,193 +0,0 @@
|
|
1
|
-
= devise_security_extension
|
2
|
-
|
3
|
-
An enterprise security extension for devise, trying to meet industrial standard security demands for web applications.
|
4
|
-
|
5
|
-
== Features
|
6
|
-
|
7
|
-
* captcha support for sign_up, sign_in, recover and unlock (to make automated mass creation and brute forcing of accounts harder)
|
8
|
-
|
9
|
-
=== Model modules
|
10
|
-
|
11
|
-
* :password_expirable - passwords will expire after a configured time (and will need an update)
|
12
|
-
* :secure_validatable - better way to validate a model (email, stronger password validation). Don't use with :validatable!
|
13
|
-
* :password_archivable - save used passwords in an old_passwords table for history checks (don't be able to use a formerly used password)
|
14
|
-
* :session_limitable - ensures, that there is only one session usable per account at once
|
15
|
-
* :expirable - expires a user account after x days of inactivity (default 90 days)
|
16
|
-
* :security_questionable - as accessible substitution for captchas (security question with captcha fallback)
|
17
|
-
|
18
|
-
== Installation
|
19
|
-
Add to Gemfile
|
20
|
-
gem 'devise_security_extension'
|
21
|
-
|
22
|
-
after bundle install
|
23
|
-
rails g devise_security_extension:install
|
24
|
-
|
25
|
-
for :secure_validatable you need to add
|
26
|
-
gem 'rails_email_validator'
|
27
|
-
|
28
|
-
== Configuration
|
29
|
-
|
30
|
-
Devise.setup do |config|
|
31
|
-
# Should the password expire (e.g 3.months)
|
32
|
-
# config.expire_password_after = 3.months
|
33
|
-
|
34
|
-
# Need 1 char of A-Z, a-z and 0-9
|
35
|
-
# config.password_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/
|
36
|
-
|
37
|
-
# How often save old passwords in archive
|
38
|
-
# config.password_archiving_count = 5
|
39
|
-
|
40
|
-
# Deny old password (true, false, count)
|
41
|
-
# config.deny_old_passwords = true
|
42
|
-
|
43
|
-
# captcha integration for recover form
|
44
|
-
# config.captcha_for_recover = true
|
45
|
-
|
46
|
-
# captcha integration for sign up form
|
47
|
-
# config.captcha_for_sign_up = true
|
48
|
-
|
49
|
-
# captcha integration for sign in form
|
50
|
-
# config.captcha_for_sign_in = true
|
51
|
-
|
52
|
-
# captcha integration for unlock form
|
53
|
-
# config.captcha_for_unlock = true
|
54
|
-
|
55
|
-
# security_question integration for recover form
|
56
|
-
# this automatically enables captchas (captcha_for_recover, as fallback)
|
57
|
-
# config.security_question_for_recover = false
|
58
|
-
|
59
|
-
# security_question integration for unlock form
|
60
|
-
# this automatically enables captchas (captcha_for_unlock, as fallback)
|
61
|
-
# config.security_question_for_unlock = false
|
62
|
-
|
63
|
-
# security_question integration for confirmation form
|
64
|
-
# this automatically enables captchas (captcha_for_confirmation, as fallback)
|
65
|
-
# config.security_question_for_confirmation = false
|
66
|
-
|
67
|
-
# ==> Configuration for :expirable
|
68
|
-
# Time period for account expiry from last_activity_at
|
69
|
-
config.expire_after = 90.days
|
70
|
-
end
|
71
|
-
|
72
|
-
== Captcha-Support
|
73
|
-
|
74
|
-
=== Installation
|
75
|
-
|
76
|
-
1. add to Gemfile "gem 'easy_captcha'"
|
77
|
-
2. install easy_captcha "rails g easy_captcha:install"
|
78
|
-
3. enable captcha - see "Configuration"
|
79
|
-
4. add captcha source in the devise views for each controller you have activated
|
80
|
-
|
81
|
-
<p><%= captcha_tag %></p>
|
82
|
-
<p><%= text_field_tag :captcha %></p>
|
83
|
-
|
84
|
-
That's it!
|
85
|
-
|
86
|
-
|
87
|
-
== Schema
|
88
|
-
|
89
|
-
=== Password expirable
|
90
|
-
|
91
|
-
create_table :the_resources do |t|
|
92
|
-
# other devise fields
|
93
|
-
|
94
|
-
t.datetime :password_changed_at
|
95
|
-
end
|
96
|
-
add_index :the_resources, :password_changed_at
|
97
|
-
|
98
|
-
=== Password archivable
|
99
|
-
|
100
|
-
create_table :old_passwords do |t|
|
101
|
-
t.string :encrypted_password, :null => false
|
102
|
-
t.string :password_salt
|
103
|
-
t.string :password_archivable_type, :null => false
|
104
|
-
t.integer :password_archivable_id, :null => false
|
105
|
-
t.datetime :created_at
|
106
|
-
end
|
107
|
-
add_index :old_passwords, [:password_archivable_type, :password_archivable_id], :name => :index_password_archivable
|
108
|
-
|
109
|
-
=== Session limitable
|
110
|
-
|
111
|
-
create_table :the_resources do |t|
|
112
|
-
# other devise fields
|
113
|
-
|
114
|
-
t.string :unique_session_id, :limit => 20
|
115
|
-
end
|
116
|
-
|
117
|
-
=== Expirable
|
118
|
-
|
119
|
-
create_table :the_resources do |t|
|
120
|
-
# other devise fields
|
121
|
-
|
122
|
-
t.datetime :last_activity_at
|
123
|
-
t.datetime :expired_at
|
124
|
-
end
|
125
|
-
add_index :the_resources, :last_activity_at
|
126
|
-
add_index :the_resources, :expired_at
|
127
|
-
|
128
|
-
=== Security questionable
|
129
|
-
|
130
|
-
create_table :security_questions do |t|
|
131
|
-
t.string :locale, :null => false
|
132
|
-
t.string :name, :null => false
|
133
|
-
end
|
134
|
-
|
135
|
-
SecurityQuestion.create! locale: :de, name: 'Wie lautet der Geburstname Ihrer Mutter?'
|
136
|
-
SecurityQuestion.create! locale: :de, name: 'Wo sind sie geboren?'
|
137
|
-
SecurityQuestion.create! locale: :de, name: 'Wie lautet der Name Ihres ersten Haustieres?'
|
138
|
-
SecurityQuestion.create! locale: :de, name: 'Was ist Ihr Lieblingsfilm?'
|
139
|
-
SecurityQuestion.create! locale: :de, name: 'Was ist Ihr Lieblingsbuch?'
|
140
|
-
SecurityQuestion.create! locale: :de, name: 'Was ist Ihr Lieblingstier?'
|
141
|
-
SecurityQuestion.create! locale: :de, name: 'Was ist Ihr Lieblings-Reiseland?'
|
142
|
-
|
143
|
-
add_column :the_resources, :security_question_id, :integer
|
144
|
-
add_column :the_resources, :security_question_answer, :string
|
145
|
-
|
146
|
-
or
|
147
|
-
|
148
|
-
create_table :the_resources do |t|
|
149
|
-
# other devise fields
|
150
|
-
|
151
|
-
t.integer :security_question_id
|
152
|
-
t.string :security_question_answer
|
153
|
-
end
|
154
|
-
|
155
|
-
== Requirements
|
156
|
-
|
157
|
-
* devise (https://github.com/plataformatec/devise)
|
158
|
-
* Rails 3 (http://github.com/rails/rails)
|
159
|
-
* recommendation: autocomplete-off (http://github.com/phatworx/autocomplete-off)
|
160
|
-
|
161
|
-
== Todo
|
162
|
-
|
163
|
-
* see the github issues (feature requests)
|
164
|
-
|
165
|
-
== History
|
166
|
-
* 0.1 expire passwords
|
167
|
-
* 0.2 strong password validation
|
168
|
-
* 0.3 password archivable with validation
|
169
|
-
* 0.4 captcha support for sign_up, sign_in, recover and unlock
|
170
|
-
* 0.5 session_limitable module
|
171
|
-
* 0.6 expirable module
|
172
|
-
* 0.7 security questionable module for recover and unlock
|
173
|
-
|
174
|
-
== Maintainers
|
175
|
-
|
176
|
-
* Team Phatworx (http://github.com/phatworx)
|
177
|
-
* Marco Scholl (http://github.com/traxanos)
|
178
|
-
* Alexander Dreher (http://github.com/alexdreher)
|
179
|
-
* Christoph Chilian (http://github.com/cc-web)
|
180
|
-
|
181
|
-
== Contributing to devise_security_extension
|
182
|
-
|
183
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
184
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
185
|
-
* Fork the project
|
186
|
-
* Start a feature/bugfix branch
|
187
|
-
* Commit and push until you are happy with your contribution
|
188
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
189
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
190
|
-
|
191
|
-
== Copyright
|
192
|
-
|
193
|
-
Copyright (c) 2011-2012 Marco Scholl. See LICENSE.txt for further details.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.7.2
|
data/test/helper.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'test/unit'
|
11
|
-
|
12
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
-
require 'devise_security_extension'
|
15
|
-
|
16
|
-
class Test::Unit::TestCase
|
17
|
-
end
|