jord-jd/password_exposed
Laravel package to block compromised passwords using the Have I Been Pwned Pwned Passwords API. Adds easy validation rules and checks during registration or password changes, helping prevent users from choosing exposed credentials.
AuthenticatesUsers, RegistersUsers traits) or as a standalone validator.PasswordExposed::check($password)) enables easy plug-and-play adoption without architectural refactoring. Can be invoked synchronously in middleware, controllers, or event listeners.config/password_exposed.php), allowing future-proofing for compliance or internal breach data integration.PasswordExposed facade) and config publishing, reducing boilerplate.Cache::remember).breach_database config).Validator extensions (e.g., PasswordExposedValidator).CheckPasswordBreach middleware for auth pipelines.password:updated or registering events.php artisan vendor:publish --provider="JordJd\PasswordExposed\PasswordExposedServiceProvider").config/password_exposed.php for API keys/database settings.public function handle(Request $request, Closure $next) {
$password = $request->input('password');
if (PasswordExposed::check($password)) {
throw new \Illuminate\Validation\ValidationException(
['password' => ['This password has been exposed in a breach.']]
);
}
return $next($request);
}
AuthenticatesUsers trait override).Monolog) to track breach database reliability.composer.json constraints.curl, json).composer update cautiously.Cache::forever for frequent passwords).PasswordExposed::checkAsync() (if supported) for background validation.| Failure | Impact | Mitigation |
|---|---|---|
| Breach API downtime | False negatives (missed breaches) | Local cache + fallback database |
| API rate-limiting | Increased latency/errors | Exponential backoff + queue retries |
| False positives | User frustration | Allow password overrides with admin flag |
| Database schema changes | Integration breaks | Versioned config migrations |
How can I help you explore Laravel packages today?