fix(enterprise): verify invited owner on acceptance - #7221
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR lets an unverified invited account review an Enterprise owner claim and atomically verifies its canonical email when ownership is accepted.
Confidence Score: 5/5The PR appears safe to merge because claim access remains token- and identity-bound, and verification is committed atomically with ownership acceptance. The removed route gates are replaced by stronger operation-time validation of the canonical account email, while all existing claim, disclosure, membership, workspace, invitation, and seat checks remain in place.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/billing/enterprise-owner-claim.ts | Atomically verifies the canonical invited account before creating ownership state and enqueueing activation, with a safe mismatch refusal. |
| apps/sim/app/api/enterprise-owner-claims/[id]/accept/route.ts | Delegates verification to the transactional acceptance service while retaining session and request-contract checks. |
| apps/sim/app/api/enterprise-owner-claims/[id]/route.ts | Permits pre-verification claim review while the service continues enforcing the exact token and invited session email. |
| apps/sim/app/enterprise/claim/[id]/enterprise-owner-claim.tsx | Removes the obsolete email-unverified error branch from the claim UI. |
| apps/sim/lib/billing/enterprise-owner-claim.test.ts | Covers transactional verification, canonical-email mismatch refusal, and prevention of downstream provisioning on mismatch. |
| apps/sim/app/api/enterprise-owner-claims/[id]/route.test.ts | Verifies that unverified invited sessions can review and submit claims through both route handlers. |
Sequence Diagram
sequenceDiagram
actor Owner
participant GET as Claim GET
participant Service as Claim Service
participant DB
participant POST as Accept POST
participant Outbox
Owner->>GET: Session + claim ID + emailed token
GET->>Service: Load claim details
Service->>DB: Read claim and current account state
Service-->>Owner: Read-only acceptance review
Owner->>POST: Token + reviewed workspace disclosure
POST->>Service: Accept claim
Service->>DB: Begin transaction
Service->>DB: Lock and validate claim
Service->>DB: Verify canonical email and set emailVerified
Service->>DB: Create ownership state and enqueue activation
DB-->>Service: Commit
Service->>Outbox: Process activation event
Service-->>Owner: Redirect to workspace
Reviews (1): Last reviewed commit: "fix(enterprise): verify invited owner on..." | Re-trigger Greptile
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Summary
Testing
bunx vitest run lib/billing/enterprise-owner-claim.test.ts app/api/enterprise-owner-claims/[id]/route.test.tsbun run type-check(apps/sim)bun run check:api-validation