Skip to content

fix(whitelist): Recognise every two-factor provider app for guests - #1672

Open
solracsf wants to merge 1 commit into
mainfrom
fix/whitelist-all-twofactor-provider-apps
Open

fix(whitelist): Recognise every two-factor provider app for guests#1672
solracsf wants to merge 1 commit into
mainfrom
fix/whitelist-all-twofactor-provider-apps

Conversation

@solracsf

Copy link
Copy Markdown
Member

Fix #1628

WHITELIST_ALWAYS hardcoded four twofactor apps, so a guest hitting any other provider got a 403 and could not finish the setup or the challenge. On an instance with enforced two-factor authentication that locks the guest out until an admin figures out that the provider app has to be whitelisted by hand.

Instead of growing that list by hand, an app that declares two-factor-providers in its info.xml is now allowed at runtime. That covers twofactor_admin, twofactor_email, twofactor_oath, twofactor_u2f and twofactor_webeid, plus any provider app that ships later.

Providers can also be registered from the app bootstrap, and that list is only reachable through private API, so those apps still have to be named. twofactor_gateway is added for that reason. The four that were already listed stay listed too: the runtime lookup only helps while info.xml is readable and while the app keeps declaring its provider there, and losing either would lock guests out again, which is the bug this fixes.

The lookup is gated on the app being enabled. That matches what ProviderLoader does, and it also keeps guessed app ids from resolving an app path on disk on every request.

@solracsf
solracsf requested a review from CarlSchwan August 21, 2026 12:28
@solracsf solracsf added the 3. to review Waiting for reviews label Aug 21, 2026
Comment thread lib/AppWhitelist.php Outdated
Comment on lines +69 to +81
/**
* Two-factor authentication has to keep working for guests, otherwise an
* instance with enforced two-factor authentication locks them out. So an
* app that declares a two-factor provider is allowed even when the
* administrator did not whitelist it.
*
* ProviderLoader also picks up providers that apps register from their
* bootstrap, but that list is only reachable through private API, so those
* apps are named in WHITELIST_ALWAYS instead.
*/
private function isTwoFactorProviderApp(string $appId): bool {
// Also keeps unknown app ids away from the info.xml lookup below,
// which would resolve the app path on disk for every guess.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* Two-factor authentication has to keep working for guests, otherwise an
* instance with enforced two-factor authentication locks them out. So an
* app that declares a two-factor provider is allowed even when the
* administrator did not whitelist it.
*
* ProviderLoader also picks up providers that apps register from their
* bootstrap, but that list is only reachable through private API, so those
* apps are named in WHITELIST_ALWAYS instead.
*/
private function isTwoFactorProviderApp(string $appId): bool {
// Also keeps unknown app ids away from the info.xml lookup below,
// which would resolve the app path on disk for every guess.
private function isTwoFactorProviderApp(string $appId): bool {

we don't need this gigantic comments

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry, I've learned that good and extensive doc is as good as good code. I'll remove it. 馃槉

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf
solracsf force-pushed the fix/whitelist-all-twofactor-provider-apps branch from 0d7093d to d4d6d66 Compare August 21, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Whitelist all two-factor provider apps for guests, not just four of them

2 participants