gitlab-org--gitlab-foss/spec/controllers
Rémy Coutable 237324cc17 Merge branch 'fix/2fa-authentication-spoofing' into 'master'
Fix 2FA authentication spoofing

## Summary

This is security fix for vulnerability described at 
https://gitlab.com/gitlab-org/gitlab-ce/issues/14900.

Attacker was able to bypass password authentication of users that have 2FA enabled, and consequently sign is as a different user, without knowing his password, if he managed to guess 2FA One Time Password for that user.

It was also possible to enumerate users and check if they have 2FA enabled, because GitLab responded with different error for each case.

## Fix

This MR attempts to change default user search scope if `otp_user_id` session variable has been set. If it is present, it means that user has 2FA enabled, and has already been verified with login and password. In this case we should look for user with `otp_user_id` first, before picking it up by `login`.

Both, 2FA authentication spoofing and 2FA discovery have been covered by specs.

## Further work

Current 2FA code is a bit tricky, so it probably needs some refactoring.



See merge request !1947
2016-04-07 11:56:44 +00:00
..
admin
ci
groups
import
profiles
projects
abuse_reports_controller_spec.rb
application_controller_spec.rb
autocomplete_controller_spec.rb
blob_controller_spec.rb
commit_controller_spec.rb
groups_controller_spec.rb
help_controller_spec.rb
invites_controller_spec.rb
namespaces_controller_spec.rb
projects_controller_spec.rb
root_controller_spec.rb
sent_notifications_controller_spec.rb
sessions_controller_spec.rb Make sessions controller specs more explicit 2016-04-07 13:16:48 +02:00
snippets_controller_spec.rb
uploads_controller_spec.rb
users_controller_spec.rb