Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(security): use session email directly instead of extra DB query
Addresses PR review feedback — align with the workspace invitation
route pattern by using session.user.email instead of re-fetching
from the database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
  • Loading branch information
waleedlatif1 and claude committed Mar 27, 2026
commit a3f48e9eb20fcc682f58d1536ee784ee04c062fd
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,8 @@ export async function GET(
}

// Verify caller is either an org member or the invitee
const userData = await db
.select({ email: user.email })
.from(user)
.where(eq(user.id, session.user.id))
.then((rows) => rows[0])

const isInvitee = userData && userData.email.toLowerCase() === orgInvitation.email.toLowerCase()
const isInvitee =
session.user.email?.toLowerCase() === orgInvitation.email.toLowerCase()

if (!isInvitee) {
const memberEntry = await db
Expand Down
Loading