GithubHelp home page GithubHelp logo

sbsurf / devise_security_extension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phatworx/devise_security_extension

1.0 2.0 0.0 189 KB

An enterprise security extension for devise, trying to meet industrial standard security demands for web applications.

License: MIT License

devise_security_extension's Introduction

devise_security_extension

An enterprise security extension for devise, trying to meet industrial standard security demands for web applications.

Features

  • captcha support for sign_up, sign_in, recover and unlock (to make automated mass creation and brute forcing of accounts harder)

Model modules

  • :password_expirable - passwords will expire after a configured time (and will need an update)

  • :secure_validatable - better way to validate a model (email, stronger password validation). Don’t use with :validatable!

  • :password_archivable - save used passwords in an old_passwords table for history checks (don’t be able to use a formerly used password)

  • :session_limitable - ensures, that there is only one session usable per account at once

  • :expirable - expires a user account after x days of inactivity (default 90 days)

Installation

Add to Gemfile

gem 'devise_security_extension'

after bundle install

rails g devise_security_extension:install

for :secure_validatable you need to add

gem 'rails_email_validator'

Configuration

Devise.setup do |config|
  # Should the password expire (e.g 3.months)
  # config.expire_password_after = 3.months

  # Need 1 char of A-Z, a-z and 0-9
  # config.password_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/

  # How often save old passwords in archive
  # config.password_archiving_count = 5

  # Deny old password (true, false, count)
  # config.deny_old_passwords = true

  # captcha integration for recover form
  # config.captcha_for_recover = true

  # captcha integration for sign up form
  # config.captcha_for_sign_up = true

  # captcha integration for sign in form
  # config.captcha_for_sign_in = true

  # captcha integration for unlock form
  # config.captcha_for_unlock = true

  # ==> Configuration for :expirable
  # Time period for account expiry from last_activity_at
  config.expire_after = 90.days
end

Captcha-Support

Installation

  1. add to Gemfile “gem ‘easy_captcha’”

  2. install easy_captcha “rails g easy_captcha:install”

  3. enable captcha - see “Configuration”

  4. add captcha source in the devise views for each controller you have activated

<p><%= captcha_tag %></p>
<p><%= text_field_tag :captcha %></p>

That’s it!

Schema

Password expirable

create_table :the_resources do |t|
  # other devise fields

  t.datetime :password_changed_at
end
add_index :the_resources, :password_changed_at

Password archivable

create_table :old_passwords do |t|
  t.string :encrypted_password, :null => false
  t.string :password_salt
  t.string :password_archivable_type, :null => false
  t.integer :password_archivable_id, :null => false
  t.datetime :created_at
end
add_index :old_passwords, [:password_archivable_type, :password_archivable_id], :name => :index_password_archivable

Session limitable

create_table :the_resources do |t|
  # other devise fields

  t.string :unique_session_id, :limit => 20
end

Expirable

create_table :the_resources do |t|
  # other devise fields

  t.datetime :last_activity_at
  t.datetime :expired_at
end
add_index :the_resources, :last_activity_at
add_index :the_resources, :expired_at

Requirements

Todo

  • see the github issues (feature requests)

History

  • 0.1 expire passwords

  • 0.2 strong password validation

  • 0.3 password archivable with validation

  • 0.4 captcha support for sign_up, sign_in, recover and unlock

  • 0.5 session_limitable module

  • 0.6 expirable module

Maintainers

Contributing to devise_security_extension

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • 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.

Copyright © 2011-2012 Marco Scholl. See LICENSE.txt for further details.

devise_security_extension's People

Contributors

traxanos avatar vizjerai avatar fidel avatar rlisowski avatar lbredeso avatar

Stargazers

yuяi avatar

Watchers

yuяi avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.