wintercms / wintercms/winter

Multi Factor Authentication

Open
#1,494 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.5k
Forks
246
Avg merge
19h 2m
Merged PRs (30d)
7

Description

Initial notes from planning issue 4 years ago:

  • Some drivers kick in after password / SSO auth, some kick in before (webauthn, hardware token)
  • Challenge / Response workflow

Authentication Stack

  • Multifactor
  • Token-based
  • Silent authentication through the cell network? Used more in the application world, sort of like SSO for phones through 5g and through carriers

Authentication Methods

  • Password
  • WebAuthN
  • Magic Link (SMS / Email)

Multifactor Authentication Challenges

  • SMS
  • Phone call
  • Email
  • Over the top service (WhatsApp, telegram, signal) - side channel communications)
  • Token (TOTP)
  • Interactive
    • App based ones (Gmail, GitHub, Steam)
    • Yes No
    • Type in number on external service from login request

Other notes:

  • Core phone number field

Drivers:

  • SMS
  • Email
    • Magic link
    • PIN

Dump of my notes on the subject here until we're closer to implementing in public:

Available factors:

  • SMS
  • Phone call / voice
  • App push notifications
  • TOTP
    • Token (usually scannable QR code) used to generate time-sensitive 6 digit codes
    • List of “recovery codes” generated and provided to user on token generation
  • “Email” (not really, basically just requiring password reset to login every time)
  • WebAuthN (like this the most because it integrates with device’s native methods, Windows Hello, FaceID, TouchID, smart keys, Yubikey, etc)
    • This supports multiple devices / integrations (phone, laptop, etc) with a list of authorized keys and a way to remove them if required
    • Could also be used for password-less authentication, but this is not 2FA and viable recovery methods for this basically boil down to logging in via email with all of the considerations that come with having that as the weakest link
  • Null
    • Testing the flow without validating it. Not sure if useful since email is low friction enough to be used for testing the flow

Considerations:

  • Want to have the same system powering both frontend and backend implementations
  • Should we have the concept of drives powered by drivers? i.e. providers powered by drivers for multiple configurations of the same driver?
  • Standard interface and events for registering additional drivers
  • This way should allow for people to host their own “Authy” / “Verify” implementation without the extra markup of those tools
  • User secrets should be encrypted
  • Users should have a method on the model that retrieves the 2FA method in use for their account (application’s responsibility to surface the available options to the user) with a valid return being null / no enabled 2FA
  • Contracts / interfaces should include a way to provide and utilize recovery codes
  • How should password resets be handled on an account with 2FA enabled?
  • Comment on https://github.com/laravel/fortify/issues/22 when the feature is completed

WebAuthN flow:
Tired of passwords

Implementations in the wild:

  • Banks
    • Forced SMS, phone, or email based on contact information on file
  • Twitter
    • 2FA options
      • SMS
      • TOTP
      • Security key (WebAuthN?)
    • Sessions
      • Shows currently active sessions
      • Shows all other authenticated sessions and provides a way to log out of all of them
        • User agent device identification
        • Last access timestamp
        • Rough IP-based geolocation (could also be more precise through the location APIs although that’s client controlled and could be prone to manipulation)
        • Can log out of all the other sessions or log out of each individual session
      • Logs of last logins with user agent, IP address, and access date
      • List of connected apps
  • Facebook
    • 2FA options
      • SMS
      • TOTP
      • Security key
      • Recovery codes
    • “Authorized logins”
      • Devices that do not have to use 2FA codes (by virtue of the device itself containing the 2FA code I’d imagine) (User friendly user agent and date of authorization)
    • Sessions
      • Same deal as Twitter pretty much
    • “App passwords”
      • Separate passwords to use to authenticate against the account without invalidating all existing sessions and authenticated devices when you want to remove the password.
      • Used more so for legacy applications that don’t have proper access through the API and instead use a username and password to connect in a flow that doesn’t support 2FA
      • Includes a user provided name for the password, the password itself in probably hashed form, and the date it was generated with the ability to remove one or all options
  • GitHub
    • 2FA options
      • TOTP
      • Security keys (WebAuthN?)
      • SMS
    • Recovery options (note that these are just as valid as regular options, and security is only as strong as the weakest link)
      • Recovery codes
      • Fallback SMS number
      • Recovery tokens
        • External authentication integrations with other providers (i.e. only Facebook is an option at the moment)
        • Do not grant self-service access to the account, are only used to help verify identity when working with support teams to gain access to the account
    • Sessions
      • Same deal as twitter
      • Includes date of first access

Implementations:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files, tests, or entry points are named; begin by reviewing the existing authentication architecture and the Laravel Fortify and Jetstream references listed in the issue. Compare the proposed provider/driver, recovery-code, encrypted-secret, and password-reset requirements with the current system. Done requires an agreed scope and design before implementation can be started.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
authentication, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.