Sign-in hardening: lockout, stronger passwords, authenticator codes

- 10 failed sign-ins in a row (password, authenticator code, or password
  at signing) lock an account for 15 minutes from any address; the user
  is emailed; admins can unlock. Same message as a wrong password.
- Passwords: at least 12 characters (max 72), refused if found in Have I
  Been Pwned (k-anonymity range API; fails open; PWNED_PASSWORDS_CHECK=false)
- Optional TOTP (authenticator app) with 10 recovery codes for password
  and emailed-link sign-in, and at signing (auth method password_totp);
  codes accepted once; admins can reset; SSO sign-in unaffected
- Demo/test passwords updated; guide, README and procedures document

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 15:17:56 -05:00
1 parent a6bfe922be
commit 14316bb60f
41 files changed
+600 -45

No files matched your search

@@ -15,7 +15,7 @@ class ElectronicSignaturesTest < ActionDispatch::IntegrationTest
end
def sign(entry = @entry, **params)
post aircraft_logbook_entry_signature_path(@a, entry), params: { certificate_id: @ap.id, password: "password123", confirm: "1" }.merge(params)
post aircraft_logbook_entry_signature_path(@a, entry), params: { certificate_id: @ap.id, password: "test-password-123", confirm: "1" }.merge(params)
end
test "signing: review, certificate, password, confirmation; then the record shows who certified what and when" do
@@ -114,14 +114,14 @@ class ElectronicSignaturesTest < ActionDispatch::IntegrationTest
assert_match "preventive maintenance", @entry.certification_statement("PILOT")
sign_in @owner # signing with someone else's certificate
post aircraft_logbook_entry_signature_path(@a, @entry), params: { certificate_id: @ap.id, password: "password123", confirm: "1" }
post aircraft_logbook_entry_signature_path(@a, @entry), params: { certificate_id: @ap.id, password: "test-password-123", confirm: "1" }
assert_includes response.body, "That certificate isn&#39;t yours"
get new_aircraft_logbook_entry_signature_path(@a, @entry)
assert_select "input[type=radio][value='#{pilot_cert.id}']:not([disabled])"
@mech.update!(disabled_at: Time.current)
assert_raises(EntrySigner::Error) { EntrySigner.new(@entry, user: @mech, certificate: @ap, auth_method: "password").sign! }
post session_path, params: { email_address: "mech@example.com", password: "password123" }
post session_path, params: { email_address: "mech@example.com", password: "test-password-123" }
assert_equal "This account is disabled.", flash[:alert]
end