fix(auth): repair the JIT placeholder email once bunyip verifies it #494
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-635-repair-jit-placeholder-email"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A bunyip user mirrored into mokosh before their email was verified lands under the
{sub}@unresolved.invalidplaceholder withemail_verified_atNULL.upsert_user_from_oidcruns on first sight only, and PMS-713 skips the/oauth2/userinfohop for an already-placed user, so nothing ever revisited that row: the placeholder was permanent. Every mokosh-side email to the account was then addressed to a domain in the RFC 2606 reserved.invalidTLD, which never resolves and is rejected outright by Google Workspace, and theemail_verified_at IS NOT NULLinvite gate could never open.bunyip_userinfo_needednow keeps fetching userinfo while the row holds a placeholder (the only way to learn the address was verified since), andplace_bunyip_usercalls the newAuthService::repair_placeholder_emailto write the real address and stampemail_verified_at. The UPDATE re-checks the placeholder domain in its WHERE clause, so it is idempotent and can never overwrite a real address. Once repaired the row returns to the no-userinfo fast path.SmtpMailer::send_multipartnow refuses a recipient in the reserved.invalidTLD instead of handing the relay a message that can only bounce. The Message-ID / Date header formation from PMS-624 is unchanged and still covered bybase_builder_sets_message_id_and_date_headers.#PMS-635
A bunyip user mirrored into mokosh before their email was verified lands under the `{sub}@unresolved.invalid` placeholder with `email_verified_at` NULL. `upsert_user_from_oidc` runs on first sight only, and PMS-713 skips the `/oauth2/userinfo` hop for an already-placed user, so nothing ever revisited that row: the placeholder was permanent. Every mokosh-side email to the account was then addressed to a domain in the RFC 2606 reserved `.invalid` TLD, which never resolves and is rejected outright by Google Workspace, and the `email_verified_at IS NOT NULL` invite gate could never open. `bunyip_userinfo_needed` now keeps fetching userinfo while the row holds a placeholder (the only way to learn the address was verified since), and `place_bunyip_user` calls the new `AuthService::repair_placeholder_email` to write the real address and stamp `email_verified_at`. The UPDATE re-checks the placeholder domain in its WHERE clause, so it is idempotent and can never overwrite a real address. Once repaired the row returns to the no-userinfo fast path. `SmtpMailer::send_multipart` now refuses a recipient in the reserved `.invalid` TLD instead of handing the relay a message that can only bounce. The Message-ID / Date header formation from PMS-624 is unchanged and still covered by `base_builder_sets_message_id_and_date_headers`. #PMS-635