fix(auth): treat empty allowedEmailRegistrationDomains as no restrictions#27179
fix(auth): treat empty allowedEmailRegistrationDomains as no restrictions#27179
Conversation
…ions (#27178) Add isEmpty() guard so that an empty domain list does not block all OAuth self-signups. The JSON schema defaults this field to [], which previously meant "no restrictions" but started blocking every signup after the domain validation was introduced in #25391. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes a regression in the OAuth/OIDC self-signup flow where an empty allowedEmailRegistrationDomains configuration (schema default []) unintentionally blocked all registrations, restoring the intended “no restrictions” behavior.
Changes:
- Update
AuthenticationCodeFlowHandler.getOrCreateOidcUser()to treat an emptyallowedEmailRegistrationDomainsset as “no restrictions”. - Add unit tests covering empty-allowed-domains, disallowed-domain, and matching-domain scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| openmetadata-service/src/main/java/org/openmetadata/service/security/AuthenticationCodeFlowHandler.java | Adds an isEmpty() guard so empty domain allowlists don’t block OAuth self-signup. |
| openmetadata-service/src/test/java/org/openmetadata/service/security/AuthenticationCodeFlowHandlerTest.java | Adds 3 unit tests validating the corrected domain-allowlist behavior. |
🟡 Playwright Results — all passed (24 flaky)✅ 3594 passed · ❌ 0 failed · 🟡 24 flaky · ⏭️ 207 skipped
🟡 24 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Code Review ✅ ApprovedTreats empty allowedEmailRegistrationDomains as no restrictions, allowing unrestricted email registration when the domain list is not configured. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
|
Failed to cherry-pick changes to the 1.12.5 branch. |
…ions (open-metadata#27178) (open-metadata#27179) Add isEmpty() guard so that an empty domain list does not block all OAuth self-signups. The JSON schema defaults this field to [], which previously meant "no restrictions" but started blocking every signup after the domain validation was introduced in open-metadata#25391. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ions (open-metadata#27178) (open-metadata#27179) Add isEmpty() guard so that an empty domain list does not block all OAuth self-signups. The JSON schema defaults this field to [], which previously meant "no restrictions" but started blocking every signup after the domain validation was introduced in open-metadata#25391. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>



Summary
!allowedDomains.isEmpty()guard toAuthenticationCodeFlowHandler.getOrCreateOidcUser()so an emptyallowedEmailRegistrationDomainsarray is treated as "no restrictions" instead of "block all domains"Root Cause
PR #25391 introduced domain validation in the OAuth self-signup flow. The check treats
[](the JSON schema default) as "no domain is allowed", which is a regression — previously empty meant "no restrictions". Since 1.12, this field is no longer shown in the UI, making it impossible to fix without a direct API call.Test plan
getOrCreateOidcUserAllowsSignupWhenAllowedDomainsEmpty— empty[]allows signup (regression fix)getOrCreateOidcUserBlocksDisallowedDomain— explicit list blocks non-matching domaingetOrCreateOidcUserAllowsMatchingDomain— explicit list allows matching domain🤖 Generated with Claude Code