-
Notifications
You must be signed in to change notification settings - Fork 53
Port Clerk to Better Auth Attempt #2 #621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
14120df
1420895
8ec7967
241784d
bb36fde
f4526e6
5f0bd36
5d5f67d
5b79556
8ce9f29
8c65ae7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| "use client"; | ||
|
|
||
| import { useClerk } from "@clerk/nextjs"; | ||
| import { authClient } from "@superset/auth/client"; | ||
| import type { RouterOutputs } from "@superset/trpc"; | ||
| import { Avatar, AvatarFallback, AvatarImage } from "@superset/ui/avatar"; | ||
| import { | ||
|
|
@@ -25,7 +25,6 @@ import { | |
| LuLogOut, | ||
| LuSettings, | ||
| } from "react-icons/lu"; | ||
|
|
||
| import { env } from "@/env"; | ||
|
|
||
| export interface NavUserProps { | ||
|
|
@@ -34,13 +33,22 @@ export interface NavUserProps { | |
|
|
||
| export function NavUser({ user }: NavUserProps) { | ||
| const { isMobile } = useSidebar(); | ||
| const { signOut } = useClerk(); | ||
|
|
||
| const userInitials = user.name | ||
| .split(" ") | ||
| .map((name) => name[0]) | ||
| .join(""); | ||
|
|
||
| const handleSignOut = async () => { | ||
| await authClient.signOut({ | ||
| fetchOptions: { | ||
| onSuccess: () => { | ||
| window.location.href = env.NEXT_PUBLIC_WEB_URL; | ||
| }, | ||
| }, | ||
| }); | ||
| }; | ||
|
Comment on lines
+42
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error handling still missing in sign-out flow. The As noted in the previous review, please add error handling with logging following the pattern 🤖 Prompt for AI Agents |
||
|
|
||
| return ( | ||
| <SidebarMenu> | ||
| <SidebarMenuItem> | ||
|
|
@@ -51,10 +59,7 @@ export function NavUser({ user }: NavUserProps) { | |
| className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground" | ||
| > | ||
| <Avatar className="h-8 w-8 rounded-lg"> | ||
| <AvatarImage | ||
| src={user.avatarUrl ?? undefined} | ||
| alt={user.name} | ||
| /> | ||
| <AvatarImage src={user.image ?? undefined} alt={user.name} /> | ||
| <AvatarFallback className="rounded-lg"> | ||
| {userInitials} | ||
| </AvatarFallback> | ||
|
|
@@ -75,10 +80,7 @@ export function NavUser({ user }: NavUserProps) { | |
| <DropdownMenuLabel className="p-0 font-normal"> | ||
| <div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm"> | ||
| <Avatar className="h-8 w-8 rounded-lg"> | ||
| <AvatarImage | ||
| src={user.avatarUrl ?? undefined} | ||
| alt={user.name} | ||
| /> | ||
| <AvatarImage src={user.image ?? undefined} alt={user.name} /> | ||
| <AvatarFallback className="rounded-lg"> | ||
| {userInitials} | ||
| </AvatarFallback> | ||
|
|
@@ -105,9 +107,7 @@ export function NavUser({ user }: NavUserProps) { | |
| </DropdownMenuItem> | ||
| </DropdownMenuGroup> | ||
| <DropdownMenuSeparator /> | ||
| <DropdownMenuItem | ||
| onClick={() => signOut({ redirectUrl: env.NEXT_PUBLIC_WEB_URL })} | ||
| > | ||
| <DropdownMenuItem onClick={handleSignOut}> | ||
| <LuLogOut /> | ||
| Log out | ||
| </DropdownMenuItem> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
better-auth npm package version 1.4.9 security vulnerabilities💡 Result:
I found multiple public security advisories for the better-auth package. Short summary relevant to version 1.4.9:
Recommendation: review the project’s official security advisories and changelog and upgrade to the latest patched release (or apply the vendor-recommended patches) before running 1.4.9 in production. Useful references: Snyk package page, GitLab/npm advisory page, and vendor security advisory entries. (security.snyk.io)
If you want, I can (a) list which specific advisories affect 1.4.9 exactly, or (b) fetch the changelog/commit that fixes a particular advisory. Which would you prefer?
Citations:
🌐 Web query:
better-auth latest stable version npm registry💡 Result:
The latest stable version on the npm registry is 1.4.7 (as of January 6, 2026). [1][2]
Sources:
[1] Snyk package page for better-auth (shows latest version 1.4.7).
[2] Better Auth release/blog pages announcing the 1.4 series.
Correct the better-auth version—1.4.9 does not exist on npm.
The specified version
^1.4.9cannot be resolved; the latest stable version on npm is 1.4.7 (as of January 2026). Update the dependency to^1.4.7or verify the intended version.Additionally, better-auth has multiple known security advisories including router baseURL poisoning, multi-session sign-out cookie-trust issues, and HTML injection flaws. Review the official security advisories and changelog to understand which patches apply to the version you deploy, and plan upgrades accordingly before production use.
Also applies to: 26-26
🤖 Prompt for AI Agents