nextcloud / nextcloud/server

Issue 2FA challenge depending on the channel of access

Open
#2,035 37 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop enhancement feature: authentication security
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Hello,

This is a small additional feature I would like to contribute, it is about Two-Factor-Authentication. The goal is to issue the second factor challenge depending on the channel of access. For example only users accessing Nextcloud through the internet should be asked to enter their OTP, while users from the intranet only need to enter the usual username/password to gain access. There are quite a number of environments conceivable where such a feature could prove useful.

For this to work, a common request header is used to determine whether the second factor challenge should be skipped. The header name is proposed to be NC_2FA_SKIP and the expected value would be "true".

I recently discussed this with @ChristophWurst who was kind to point me to a starting point in the OC\Authentication\TwoFactorAuth\Manager class.

Once I'll get the code ready, I'll open a PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OC\Authentication\TwoFactorAuth\Manager in lib/private/Authentication/TwoFactorAuth/Manager.php, especially the linked lines, and trace how the second-factor challenge decision is made. Define and validate the behavior for the proposed NC_2FA_SKIP: "true" header, including which access requests should bypass the OTP challenge.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.