Skip to content

fix(enterprise): verify invited owner on acceptance - #7221

Merged
icecrasher321 merged 2 commits into
stagingfrom
codex/fix-enterprise-owner-claim-email-verification
Aug 28, 2026
Merged

fix(enterprise): verify invited owner on acceptance#7221
icecrasher321 merged 2 commits into
stagingfrom
codex/fix-enterprise-owner-claim-email-verification

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

  • let a newly created, unverified account review its securely tokenized Enterprise owner claim
  • verify the canonical account email inside the same transaction that accepts ownership and enqueues activation
  • keep claim GET read-only so email scanners cannot verify or activate the account
  • retain exact token, session-email, current account-email, membership, workspace, invitation, and seat validation

Testing

  • bunx vitest run lib/billing/enterprise-owner-claim.test.ts app/api/enterprise-owner-claims/[id]/route.test.ts
  • bun run type-check (apps/sim)
  • scoped Biome check
  • bun run check:api-validation

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 28, 2026 6:44pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR lets an unverified invited account review an Enterprise owner claim and atomically verifies its canonical email when ownership is accepted.

  • Removes route-level verification gates while retaining authenticated-session and claim validation.
  • Adds a canonical user-email match and verification update inside the ownership-acceptance transaction.
  • Keeps claim review read-only and adds coverage for unverified sessions and canonical-email mismatches.

Confidence Score: 5/5

The 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.

Important Files Changed

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
Loading

Reviews (1): Last reviewed commit: "fix(enterprise): verify invited owner on..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/billing/enterprise-owner-claim.test.ts
@icecrasher321
icecrasher321 merged commit eadf30a into staging Aug 28, 2026
25 checks passed
@icecrasher321
icecrasher321 deleted the codex/fix-enterprise-owner-claim-email-verification branch August 28, 2026 18:52
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