Skip to content

v2.0.0

Latest

Choose a tag to compare

@kobaltz kobaltz released this 06 Nov 12:59
· 1 commit to main since this release

ActionAuth 2.0.0 fixes serious security problems and adds OAuth sign in, account lockout and account suspension. Everyone should upgrade, especially if the webauthn gem is installed or SMS authentication is turned on. A few changes can affect your app or its tests, so please read the upgrade notes first.

Rails 7.2 or later is now required, and Ruby 3.3 or later is recommended.

Upgrading

bundle update action_auth
bin/rails action_auth:install:migrations
bin/rails db:migrate

Run the migrations as part of your deploy, before the new code takes requests. Until they have run, requesting a magic link raises an error telling you to run them. Everything else keeps working, but lockout and suspension do nothing yet.

What your users will notice

  • Accounts lock after 10 failed passwords or SMS codes in a row, for 30 minutes, and the owner is sent an email. Set config.account_lockout_enabled = false to turn this off.
  • Verifying an email now asks for the account's password. Verification links already sent keep working, and go to the new page.
  • Magic links now take a second click, on a "Sign in" button, so mail scanners don't use them up.
  • The first magic link on an unverified account replaces its password, ends its sessions and removes its connected OAuth accounts. The "Sign in" page warns them first, and they can use Reset Password afterwards. If you run with verify_email_on_sign_in = false, expect this to reach most of your password users, because nothing else verifies them.
  • Magic links and password reset links sent before you upgrade stop working. People can request new ones.

What may need a change in your app

  • Your delete account button needs a password field. A button_to copied from the README now sends people to the management screen instead of deleting the account. See Account Deletion.
  • Rate limits need a working cache. They use config.cache_store, and :null_store turns them off. With several server processes, use a shared store such as Solid Cache or Redis.
  • Flash messages are now displayed by the views. To use your layout's styling instead, make app/views/action_auth/shared/_flash.html.erb an empty file.
  • If you copied views or the layout, or have your own WebAuthn JavaScript, see the upgrade notes in the changelog. A copied identity/emails/edit needs a password_challenge field, or changing an email will keep failing.
  • GET /sessions/:id had no action, and has been removed.

What may need a change in your tests

  • Password complexity, session timeouts and same_site are no longer skipped in the test environment. If your tests create users with simple passwords, use stronger ones or add:

    config.password_complexity_check = !Rails.env.test?
  • If a test fails a sign in 10 times for one user, it needs config.account_lockout_enabled = false.

  • To verify an email, PATCH the token and password instead of opening the link: patch identity_email_verification_path, params: { sid: token, password: password }.

  • To use a magic link, POST the token to magics_sign_ins_path instead of opening the link.

  • If a test signs in with a magic link and then uses the password or counts sessions, verify the user first.

New

  • OAuth. Sign in with Google, GitHub, Facebook, X or any other OmniAuth strategy. It's opt in, like WebAuthn: add the gems and at least one config.oauth_provider. A matching email address never signs anyone in to an existing account, and you should only add providers that verify email addresses. See OAuth.
  • Account lockout, on by default. Magic links, passkeys, OAuth and existing sessions keep working during a lock. See Account Lockout.
  • Account suspension. user.suspend_account! blocks every way of signing in and ends the account's sessions. Only your app can suspend anyone. See Account Suspension.
  • Easier customizing. bin/rails generate action_auth:views copies the views into your app, config.layout and config.parent_controller connect the screens to your app, and config.after_sign_in_path and config.after_sign_out_path set where people land. See Customizing.
  • Sprockets apps no longer need to add ActionAuth's assets to manifest.js.

Security fixes

  • Passkey sign in didn't verify anything. Anyone who had a credential ID could sign in as that user. This is on by default when the webauthn gem is installed. It now verifies the signature, the challenge, the sign count and that the user was verified on the device.
  • SMS sign in could be used to take over other accounts. A request with no phone number matched the first account without one, and a single request could try a whole list of codes. SMS authentication is off by default.
  • Magic links and SMS codes skipped the security key. Accounts with a security key now have to use it after either one.
  • Magic links could be used more than once. A link now works once, and using one uses up any others sent to that account. Links also stop working when the account's email changes.
  • Someone could keep access to an account set up with another person's email address. The password and any open sessions kept working after the address's real owner first signed in with a magic link. That first magic link now removes them.
  • Opening the email verification link was enough to verify an address. If someone signed up with another person's address, that person or their mail scanner opening the link made the account verified and the password usable. Verifying now takes both the link and the password. An address's owner who doesn't know the password can take over the account with a password reset, which now works on unverified accounts.
  • Password reset links kept working after an email change. They're now tied to the address they were sent to.
  • Deleting an account didn't ask for the password.
  • WebAuthn challenges could be reused. They're now used up on the first attempt.
  • Session cookies were inconsistent. Every sign in path now sets the secure flag and insert_cookie_domain in the same way.
  • The password reset form revealed who has an account. It now gives the same answer for every address.
  • Rate limits added to magic link requests, SMS requests and code guesses, passkey sign in, password reset and verification requests, and changing your email. Before this, a six digit SMS code could be guessed as fast as requests could be sent.
  • WebAuthn scripts no longer load on pages with password fields, and Stimulus is pinned to an exact version.
  • SMS codes now come from SecureRandom, and CSRF protection is on whether or not the app's defaults turn it on.

Other fixes

  • Passkeys registered through the normal flow can now be used for passkey sign in. Passkeys registered before this release may need to be registered again to be used without a password.
  • Two step sign in now works in an app whose ApplicationController requires sign in.
  • Changing your email now works from the default form, and an unverified user can correct a mistyped address.
  • Logging out another device no longer logs out the current one.
  • A Have I Been Pwned outage no longer breaks sign up or password changes. It counts as "not pwned" and is logged.
  • bin/rails action_auth:install no longer adds a second mount that stops the app from booting.

See the full changelog for everything in this release.

Compare: v1.8.9...v2.0.0