Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't allow enforcing 2FA when no provider is enabled #13735

Closed
wants to merge 9 commits into from

Conversation

rummatee
Copy link
Contributor

Fixes issue #12267
I decided to pass a complete list of enabled 2FA providers to the template, so that if we decide to do something with this information (for example show a list of the names) this is now easy to change.

@blizzz
Copy link
Member

blizzz commented Jan 24, 2019

thanks for the PR, I think it makes sense. Please also adjust and extend the failing tests.

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@@ -30,7 +30,10 @@

<div id="two-factor-auth" class="section">
<h2><?php p($l->t('Two-Factor Authentication'));?></h2>
<?php unset($_['twoFactorProviderData']['backup_codes']); if (!empty($_['twoFactorProviderData'])) { ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the original ticket. We must not hide the full UI, but just add a warning ;) There are use cases where enforcing 2FA with user that don't have it yet is still desirable, for example when they get enrolled afterwards.


foreach ($allApps as $appId) {
$info = $this->appManager->getAppInfo($appId);
if (isset($info['two-factor-providers'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be cleaned up a bit as it duplicates a lot of the logic from the other method (I can help you with that)

@ChristophWurst ChristophWurst self-assigned this Jan 25, 2019
@ChristophWurst ChristophWurst self-requested a review January 25, 2019 12:54
@rummatee rummatee force-pushed the issue12267 branch 2 times, most recently from 414501f to 02a1db9 Compare January 26, 2019 13:02
$('#two-factor-warning').toggleClass('hidden', !this.state.enforced);
}

saveChanges();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually understand why it makes sense to save the changes immediately, but since this was the behavior before, I left it this way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this has changed in the meantime. Saving is now explicit.

@rummatee
Copy link
Contributor Author

rummatee commented Feb 6, 2019

So, does this new approach, that works with the .vue files rather than with the php templates solve your objections about the code duplication and about warning the admin instead of disabling? @ChristophWurst
I don't really have a lot of experience with vue. The readme said to commit the compiled files as well so I did, but I see that (of course) they lead to a lot of conflicts. Should I do something about that?

@ChristophWurst
Copy link
Member

I don't really have a lot of experience with vue. The readme said to commit the compiled files as well so I did, but I see that (of course) they lead to a lot of conflicts. Should I do something about that?

There are conflicts because the webpack bundle has been touched by other PRs as well. You can resolve this by rebasing the branch onto the latest master. When you see conflicts in one of the files above don't try to manually resolve them but just rebuild the js 😉

@ChristophWurst ChristophWurst added 1. to develop Accepted and waiting to be taken care of and removed 3. to review Waiting for reviews labels Mar 1, 2019
@ChristophWurst
Copy link
Member

I will try to tackle this for Nextcloud 17. We should do more accurate queries whether providers are enabled in general and in the case of the admin. This needs a bit of work.

@rummatee
Copy link
Contributor Author

Sorry for the late reply, I had university exams.

I am not completely sure if I understand your comment correctly.
So you want to have 2 different warnings:
One warning if no app is enabled that provides a method for 2FA, because then nobody can log in anymore.
And a different if there are apps enabled that provide 2FA, but the admin didn't set up a mothod for themself, because in this case the admin could not log in anymore.
Is that correct?

I think the second case would be issue #12269 rather than #12267 and I think that it would be also solved by allowing to set up 2FA on login as described in issue #12268. However I can also work on providing 2 different warnings.

@ChristophWurst
Copy link
Member

Is that correct?

Yes, that is correct.

Yes, for users it will be possible to set up 2FA on login in the future. But when admins enforce it, I would prefer to already warn them on enforcing if they haven't set up a provider. It sounds a bit too scary for me to hope the admin will successfully set it up afterwards. I would rather have that ensured beforehand.

Signed-off-by: Joas Schilling <coding@schilljs.com>
nickvergessen and others added 7 commits March 31, 2019 19:51
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Florian Schunk <florian.schunk@rwth-aachen.de>
@rummatee
Copy link
Contributor Author

rummatee commented Mar 31, 2019

Sorry, I didn't mean to put all these commits from master in here. How did that happen?

In any case, now it should show different warnings in the case of no provider enabled at all and no provider enabled for the admin.

  • Layout for the warnings

Signed-off-by: Florian Schunk <florian.schunk@rwth-aachen.de>
@MorrisJobke
Copy link
Member

Rebased and resolved the issues here in #16463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of feature: authentication security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants