Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(studio): guard unguarded requester.name reads on the OAuth authorize and apps pages (#49267)

claude[bot]2bc6144aecfa
diff --git a/apps/studio/components/interfaces/Auth/OAuthApps/oauthApps.utils.ts b/apps/studio/components/interfaces/Auth/OAuthApps/oauthApps.utils.ts
index f1f6ad52c6e..94d732d0601 100644
--- a/apps/studio/components/interfaces/Auth/OAuthApps/oauthApps.utils.ts
+++ b/apps/studio/components/interfaces/Auth/OAuthApps/oauthApps.utils.ts
@@ -27,8 +27,8 @@ export function filterOAuthApps({
// Filter by search string
if (searchString) {
const searchLower = searchString.toLowerCase()
- const matchesName = app.client_name.toLowerCase().includes(searchLower)
- const matchesClientId = app.client_id.toLowerCase().includes(searchLower)
+ const matchesName = app.client_name?.toLowerCase().includes(searchLower) ?? false
+ const matchesClientId = app.client_id?.toLowerCase().includes(searchLower) ?? false
if (!matchesName && !matchesClientId) {
return false
}
diff --git a/apps/studio/components/interfaces/Organization/OAuthApps/OAuthApps.utils.ts b/apps/studio/components/interfaces/Organization/OAuthApps/OAuthApps.utils.ts
index e8f942cf7a0..13be7546cb2 100644
--- a/apps/studio/components/interfaces/Organization/OAuthApps/OAuthApps.utils.ts
+++ b/apps/studio/components/interfaces/Organization/OAuthApps/OAuthApps.utils.ts
@@ -86,7 +86,11 @@ export function findTrustedPartnerByRedirectUri(
)
}
-export function findTrustedPartnerByName(name: string): TrustedOAuthPartner | null {
+export function findTrustedPartnerByName(
+ name: string | null | undefined
+): TrustedOAuthPartner | null {
+ if (!name) return null
+
const searchable = name.toLowerCase()
return (
TRUSTED_OAUTH_PARTNERS.find((partner) =>
@@ -154,7 +158,7 @@ export function getOAuthImpersonationWarning({
name,
redirectUri,
}: {
- name: string
+ name: string | null | undefined
redirectUri: string | null | undefined
}): OAuthImpersonationWarning | null {
const namedPartner = findTrustedPartnerByName(name)
diff --git a/apps/studio/components/interfaces/Organization/ProjectClaim/confirm.tsx b/apps/studio/components/interfaces/Organization/ProjectClaim/confirm.tsx
index c19aa0349c8..fe125a2f998 100644
--- a/apps/studio/components/interfaces/Organization/ProjectClaim/confirm.tsx
+++ b/apps/studio/components/interfaces/Organization/ProjectClaim/confirm.tsx
@@ -85,7 +85,7 @@ export const ProjectClaimConfirm = ({
}}
>
{!requester.icon && (
- <p className="text-foreground-light text-lg">{requester.name[0]}</p>
+ <p className="text-foreground-light text-lg">{requester.name?.[0] ?? '?'}</p>
)}
</div>