Skip to content

feat(auth): admin allow-list overrides allow_registration:false#12

Merged
rafiki270 merged 1 commit into
mainfrom
feat/admin-allowlist-overrides-registration
Jun 15, 2026
Merged

feat(auth): admin allow-list overrides allow_registration:false#12
rafiki270 merged 1 commit into
mainfrom
feat/admin-allowlist-overrides-registration

Conversation

@rafiki270

Copy link
Copy Markdown
Contributor

Makes the admin "Allowed individual emails" / "Allowed email domains" lists do what they intuitively imply: an explicit invite allow-list that lets a listed person sign in even when the service has allow_registration: false.

The gap this closes

The registration gate (social-login.service.ts) only ever consulted the signed config (allow_registration, allowed_registration_domains) — it never read the admin-managed DB allow-list. So a whitelisted-but-unregistered email was blocked at registration before the list was ever looked at. (The list was only enforced as a restriction on already-authenticated users.)

Change

  • New isEmailAdminAllowedForRegistration (login-domain-policy.service.ts): reads the client domain's allowedEmails (exact) + allowedEmailDomains (email domain) on the BYPASSRLS admin client. Empty list ⇒ grants nothing. Client-domain level only (a brand-new user has no org/team membership yet).
  • Wired into the new-user gate in loginWithSocialProfile as an explicit override, next to the existing first-superuser-bootstrap exception.
  • Gate 2 (assertEmailDomainAllowedForLogin) already admits these users (their email/domain is in the same list), so both gates agree — no lock-out surprise.
  • Admin help text updated.

Verification

  • New tests: +1 social-login (allow-list admits a new user under reg:false), +5 policy (exact email, email domain, no match, empty lists, missing domain).
  • Full API suite 531 passed, 77 skipped; typecheck, lint, and build green for all packages.

🤖 Generated with Claude Code

A superuser-managed client-domain allow-list (admin "Allowed individual
emails" / "Allowed email domains") now also acts as an explicit
registration grant: a new social user whose exact email — or whose email
domain — is listed may sign in even when the service config has
allow_registration:false. Previously the registration gate
(social-login.service) only ever consulted the signed config and never the
admin DB allow-list, so a whitelisted-but-unregistered user was blocked
before the list was ever read.

- New `isEmailAdminAllowedForRegistration` (login-domain-policy.service):
  reads the client domain's allowedEmails/allowedEmailDomains on the
  BYPASSRLS admin client; empty list grants nothing. Client-domain level
  only (a brand-new user has no org/team membership yet).
- Wired into the new-user gate in loginWithSocialProfile as an explicit
  override, alongside the existing superuser-bootstrap exception.
- Gate 2 (assertEmailDomainAllowedForLogin) already admits these users
  since their email/domain is in the same list, so both gates agree.
- Admin help text updated to state the list doubles as an invite allow-list.

Tests: +1 social-login (allow-list admits new user under reg:false) and +5
login-domain-policy (email/domain match, no match, empty, missing domain).
Full API suite 531 passed; typecheck/lint/build green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@rafiki270 rafiki270 merged commit e45da40 into main Jun 15, 2026
1 check passed
@rafiki270 rafiki270 deleted the feat/admin-allowlist-overrides-registration branch June 15, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant