Skip to content

Commit

Permalink
Fix paranoid-mode being ignored (#138)
Browse files Browse the repository at this point in the history
* Fix paranoid-mode being ignored

Devise's paranoid-mode is meant to hide when a record with an e-mail exists in the system, by always showing the invalid error message instead of conditionally revealing when a record is not found. This gem ignores the setting and reveals existing accounts during an enumeration attack.
  • Loading branch information
Gargron authored and QuinnWilton committed Jan 7, 2019
1 parent f3e40dc commit 5549aba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -12,7 +12,7 @@ def authenticate!
super
end

fail(:not_found_in_database) unless resource
fail(Devise.paranoid ? :invalid : :not_found_in_database) unless resource

# We want to cascade to the next strategy if this one fails,
# but database authenticatable automatically halts on a bad password
Expand Down
2 changes: 1 addition & 1 deletion lib/devise_two_factor/strategies/two_factor_backupable.rb
Expand Up @@ -12,7 +12,7 @@ def authenticate!
super
end

fail(:not_found_in_database) unless resource
fail(Devise.paranoid ? :invalid : :not_found_in_database) unless resource

# We want to cascade to the next strategy if this one fails,
# but database authenticatable automatically halts on a bad password
Expand Down

0 comments on commit 5549aba

Please sign in to comment.