Skip to content

Check user passwords against HIBP on login#6119

Draft
colby-swandale wants to merge 6 commits intomasterfrom
colby/hibp-on-login
Draft

Check user passwords against HIBP on login#6119
colby-swandale wants to merge 6 commits intomasterfrom
colby/hibp-on-login

Conversation

@colby-swandale
Copy link
Member

What's this about?

This PR implements password breach checking against the https://haveibeenpwned.com (HIBP) database during user login. When a user attempts to sign in with a password that appears in known data breaches, the system will prompt the user to change their password.

When users have MFA enabled, they are allowed to complete login but are then redirected to reset their password. If the user does not have MFA enabled, they will be asked to complete an out-of-band password reset via the standard rubygems.org password reset email.

Why this matters

Credential stuffing attacks are one of the most common vectors for account compromise. Users frequently reuse passwords across services, so when credentials leak from one site, attackers try them everywhere. This feature proactively protects RubyGems.org users and the Ruby ecosystem from compromised credentials being used to access accounts.

Screenshots

Users With MFA after login

TODO

Users Without MFA after login

Screenshot 2025-11-27 at 5 44 33 pm

@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 26.19048% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.56%. Comparing base (169da15) to head (4b20855).

Files with missing lines Patch % Lines
app/controllers/sessions_controller.rb 22.72% 17 Missing ⚠️
app/helpers/users_helper.rb 20.00% 12 Missing ⚠️
...pp/controllers/compromised_passwords_controller.rb 46.15% 7 Missing ⚠️
app/controllers/passwords_controller.rb 0.00% 7 Missing ⚠️
...vents/user_event/password/compromised_component.rb 0.00% 7 Missing ⚠️
lib/password_breach_checker.rb 40.00% 6 Missing ⚠️
app/mailers/password_mailer.rb 20.00% 4 Missing ⚠️
app/controllers/concerns/require_mfa.rb 0.00% 1 Missing ⚠️
app/controllers/email_confirmations_controller.rb 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6119      +/-   ##
==========================================
- Coverage   38.65%   38.56%   -0.09%     
==========================================
  Files         487      490       +3     
  Lines       10718    10799      +81     
==========================================
+ Hits         4143     4165      +22     
- Misses       6575     6634      +59     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@colby-swandale colby-swandale moved this from Todo to In Progress in RubyGems.org Pull Requests Dec 1, 2025
@colby-swandale colby-swandale self-assigned this Dec 1, 2025
- Update layout for multifactor authentication prompt to use "hammy"
- Adjust session controller layout to include additional actions
- Modify compromised password view to conditionally display steps based on user sign-in status
- Add new translation for "Continue to Dashboard" in locale file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant