Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Devise OTP implements two-factors authentication for Devise, using an rfc6238 compatible Time-Based One-Time Password Algorithm. It uses the rotp library for generation and verification of codes.
If you are upgrading from version 0.1.x, you will need to regenerate your views.
It currently has the following features:
Compatible token devices are:
Although there's an adjustable drift window, it is important that both the server and the token device (phone) have their clocks set (eg: using NTP).
Add this line to your application's Gemfile:
gem 'devise'
gem 'devise-otp'
And then execute:
$ bundle
Or install it yourself as:
$ gem install devise-otp
To setup Devise, you need to do the following (but refer to https://github.com/plataformatec/devise for more information)
Install Devise:
rails g devise:install
Setup the User or Admin model
rails g devise MODEL
Configure your app for authorisation, edit your Controller and add this before_action:
before_action :authenticate_user!
Make sure your "root" route is configured in config/routes.rb
Run the following generator to add the necessary configuration options to Devise's config file:
rails g devise_otp:install
After you've created your Devise user models (which is usually done with a "rails g devise MODEL"), set up your Devise OTP additions:
rails g devise_otp MODEL
Don't forget to migrate:
rake db:migrate
Add the gem's javascript to you application.js
//= require devise-otp
If you want to customise your views (which you likely will want to), you can use the generator:
rails g devise_otp:views
The install generator also installs an english copy of a Devise OTP i18n file. This can be modified (or used to create other language versions) and is located at: config/locales/devise.otp.en.yml
With this extension enabled, the following is expected behaviour:
The install generator adds some options to the end of your Devise config file (config/initializers/devise.rb)
config.otp_mandatory
- OTP is mandatory, users are going to be asked to enroll the next time they sign in, before they can successfully complete the session establishment.config.otp_authentication_timeout
- how long the user has to authenticate with their token. (defaults to 3.minutes
)config.otp_drift_window
- a window which provides allowance for drift between a user's token device clock (and therefore their OTP tokens) and the authentication server's clock. Expressed in minutes centered at the current time. (default: 3
)config.otp_credentials_refresh
- Users that have logged in longer than this time ago, are going to be asked their password (and an OTP challenge, if enabled) before they can see or change their otp informations. (defaults to 15.minutes
)config.otp_recovery_tokens
- Whether the users are given a list of one-time recovery tokens, for emergency access (default: 10
, set to false
to disable)config.otp_trust_persistence
- The user is allowed to set his browser as "trusted", no more OTP challenges will be asked for that browser, for a limited time. (default: 1.month
, set to false to disable setting the browser as trusted)config.otp_issuer
- The name of the token issuer, to be added to the provisioning url. Display will vary based on token application. (defaults to the Rails application class)git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)I started this extension by forking devise_google_authenticator, and this project still contains some chunk of code from it, esp. in the tests and generators. At some point, my design goals were significantly diverging, so I refactored most of its code. Still, I want to thank the original author for his relevant contribution.
MIT Licensed
FAQs
Unknown package
We found that devise-otp-rails5 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.