feat(organizations): add verified domain auto-join - #5437
Conversation
| } | ||
|
|
||
| if (!isAccountLinking) { | ||
| await ensureVerifiedDomainOrganizationMembership(result.user.id); |
There was a problem hiding this comment.
CRITICAL: Unproven social emails still trigger verified-domain auto-join
ensureVerifiedDomainOrganizationMembership runs for every non-linking sign-in, including GitHub/GitLab/Discord/LinkedIn. This file already treats those providers as never proving email (profileProvesEmailOwnership) and therefore refuses auto-link, but a new GitHub signup with user@acme.com still becomes an ordinary member of the Acme org.
Gate admission on the same proof used for autoLinkToExistingUser (isEmailAuth || isFakeLogin || profileProvesEmailOwnership(profile)), or persist a verified-email bit and check it inside ensureVerifiedDomainOrganizationMembership. The sign-in test currently locks in the insecure GitHub path.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| const createClaim = useMutation( | ||
| trpc.organizations.verifiedDomains.create.mutationOptions({ | ||
| onSuccess: async data => { | ||
| if (verificationPortal.current) { |
There was a problem hiding this comment.
WARNING: Closed or unmounted verification popup is not cleaned up
A reserved Window stays truthy after the user closes it, so verificationPortal.current.location.href = … throws. That skips onError, so verificationRequestPending never resets and later Claim / Open verification clicks no-op until remount.
There is also no unmount effect to close the reserved tab, so navigating away mid-mutation leaks the popup.
Check closed before assigning, reset the pending flag in finally, and close the reserved window on unmount.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Files Reviewed (31 files)
Fix these issues in Kilo Cloud Reviewed by grok-4.6 · Input: 197.1K · Output: 22.6K · Cached: 878.1K Review guidance: REVIEW.md from base branch |
Summary
Validation
pnpm --filter web typecheckscripts/typecheck-all.sh --changes-onlypnpm --filter web lintpnpm --filter @kilocode/db exec drizzle-kit checkpnpm format:checkpnpm drizzle generatereports no schema changesgit diff --checkRemaining validation gaps
pnpm drizzle:verify-bootstrapexits before PostgreSQL receives SQL with a non-diagnostic Drizzleundefinederror; migration consistency and database-backed feature tests pass