<!-- Source: @site/projects/fortify-hardening-for-laravel/docs/index.md -->
<!-- Canonical: https://docs.pushery.com/fortify-hardening-for-laravel/ -->

# Fortify Hardening for Laravel

> Stops account enumeration in Laravel Fortify: neutral answers on registration and password reset, equal timing, and a notice to the owner.

Laravel Fortify tells anyone who asks whether an email address has an account. Its registration
form refuses a taken address with "The email has already been taken.", its reset-link form answers
an unknown address with "We can't find a user with that email address.", and a password reset
names the same difference. Each of those answers is enough to check a list of addresses against
your application, one request at a time.

This package closes all three, and the difference in time behind them.

![The notice in a mail program: from Linen & Co, hello@shop.example, to mira@example.com, with the subject "Someone tried to register at Linen & Co with your email address". It says that somebody tried to create an account with this address and that the holder already has one, offers a Sign in button, and adds that a forgotten password can be reset from the sign-in page and that nothing needs to be done if it was not the holder.](https://docs.pushery.com/assets/images/account-exists-notice-664620db40a6ade1ade7c19c454ee0fc.webp)

```bash
composer require pushery/fortify-hardening-for-laravel
```

The package is on [Packagist](https://packagist.org/packages/pushery/fortify-hardening-for-laravel),
and the source and the issue tracker live at
[github.com/pushery/fortify-hardening-for-laravel](https://github.com/pushery/fortify-hardening-for-laravel).

## Requirements

- PHP 8.4+ (tested on 8.4.27, 8.5.x and 8.6.x)
- Laravel 13+
- Laravel Fortify 1.34.1+, with its `registration` and `resetPasswords` features

## What changes

| Where | Fortify on its own | With the package |
|---|---|---|
| Registration | a taken address is refused, a free one is signed in | both get "check your inbox", nobody is signed in, the holder of a taken address gets a notice |
| Reset link | an unknown address is refused, an address that asked a minute ago is told to wait | every request reads like a link that was sent |
| Password reset | an unknown address and a wrong token give different errors | every failure reads like a wrong token |
| Timing | a taken address answers in a fraction of the time a free one takes, and a known address takes longer on the password routes | both answers take the same time |
| Sign-in limiter | failed sign-ins are counted under the address and the IP as they are, which then stand in the cache and in what an error tracker records, and again by the `login` limiter of your service provider under an MD5 a guessed address and IP compute | Fortify's count under a key hashed with the application key, and [a helper](https://docs.pushery.com/fortify-hardening-for-laravel/timing.md#the-login-limiter-of-your-service-provider) that keys the `login` limiter the same way |

The package keeps Fortify's routes, its controllers for everything else and your own actions. It
puts its answers in place of Fortify's through the container, so there is no route to register
and no view to publish.

## Pages

- [Installation](https://docs.pushery.com/fortify-hardening-for-laravel/installation.md): what to install, and the two things your application has
  to provide.
- [Registration](https://docs.pushery.com/fortify-hardening-for-laravel/registration.md): the neutral registration on Fortify's route, the notice to
  the holder, and the same flow from a controller of your own.
- [Password reset](https://docs.pushery.com/fortify-hardening-for-laravel/password-reset.md): the reset-link request and the reset itself.
- [Timing](https://docs.pushery.com/fortify-hardening-for-laravel/timing.md): why a neutral text is not enough, and how both answers come to take the
  same time.
- [Testing your application](https://docs.pushery.com/fortify-hardening-for-laravel/testing.md): the assertion the package ships, to prove the
  property in your own suite.
- [Configuration](https://docs.pushery.com/fortify-hardening-for-laravel/configuration.md): every setting, its environment variable and its default,
  and the translations.
- [What it does not cover](https://docs.pushery.com/fortify-hardening-for-laravel/limits.md): the routes and the guarantees left to your application,
  and what to do about each.
