Skip to content

Empty allowedEmailRegistrationDomains blocks all OAuth self-signups #27178

Closed

Description

@aji-aju

Description

After PR #25391 introduced domain validation in the OAuth self-signup flow, an empty allowedEmailRegistrationDomains array ([]) blocks all new user registrations via OAuth instead of allowing them.

Root Cause

The domain check in AuthenticationCodeFlowHandler.getOrCreateOidcUser() (line 932) does not account for an empty set:

Set<String> allowedDomains = authorizerConfiguration.getAllowedEmailRegistrationDomains();
if (allowedDomains != null
    && !allowedDomains.contains("all")
    && !allowedDomains.contains(domain)) {
  throw new AuthenticationException("Email domain not allowed for self-signup: " + domain);
}

An empty Set is not null, doesn't contain "all", and doesn't contain any domain — so every signup is rejected.

The JSON schema defaults this field to [], meaning any deployment that didn't explicitly configure it now silently blocks all OAuth self-registrations.

Impact

  • Regression from prior behavior where empty [] meant "no domain restrictions"
  • Since 1.12, this field is no longer exposed in the UI (removed due to user confusion with principalDomain and allowedDomains), making it impossible to fix without a direct API call to PATCH /api/v1/system/security/config
  • Any customer upgrading to a version with this change will have broken OAuth self-signup if allowedEmailRegistrationDomains was left at the default

Error Log

WARN SECURITY: Blocked OAuth signup for disallowed domain: gmail.com (user: user@gmail.com)

Fix

Add !allowedDomains.isEmpty() to the condition to restore backwards-compatible behavior:

if (allowedDomains != null
    && !allowedDomains.isEmpty()       // treat empty as "no restrictions"
    && !allowedDomains.contains("all")
    && !allowedDomains.contains(domain)) {

Release

1.12.5

Metadata

Metadata

Assignees

Labels

bugplatform

Type

No type

Projects

  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions