Skip to content

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

Fix: slack integration and sample code (#35862)

Stephen Morgan9fa1b6682601
diff --git a/apps/docs/content/_partials/oauth_pkce_flow.mdx b/apps/docs/content/_partials/oauth_pkce_flow.mdx
index a670367a1d7..c98eacb6336 100644
--- a/apps/docs/content/_partials/oauth_pkce_flow.mdx
+++ b/apps/docs/content/_partials/oauth_pkce_flow.mdx
@@ -76,7 +76,11 @@ export async function GET(request: Request) {
const { searchParams, origin } = new URL(request.url)
const code = searchParams.get('code')
// if "next" is in param, use it as the redirect URL
- const next = searchParams.get('next') ?? '/'
+ let next = searchParams.get('next') ?? '/'
+ if (!next.startsWith('/')) {
+ // if "next" is not a relative URL, use the default
+ next = '/'
+ }
if (code) {
const supabase = await createClient()
diff --git a/apps/docs/content/guides/auth/social-login/auth-workos.mdx b/apps/docs/content/guides/auth/social-login/auth-workos.mdx
index 32ad6d07c67..56a9c1fb5ee 100644
--- a/apps/docs/content/guides/auth/social-login/auth-workos.mdx
+++ b/apps/docs/content/guides/auth/social-login/auth-workos.mdx
@@ -91,7 +91,11 @@ export async function GET(request: Request) {
const { searchParams, origin } = new URL(request.url)
const code = searchParams.get('code')
// if "next" is in param, use it as the redirect URL
- const next = searchParams.get('next') ?? '/'
+ let next = searchParams.get('next') ?? '/'
+ if (!next.startsWith('/')) {
+ // if "next" is not a relative URL, use the default
+ next = '/'
+ }
if (code) {
const supabase = await createClient()
diff --git a/apps/ui-library/registry/default/blocks/social-auth-nextjs/app/auth/oauth/route.ts b/apps/ui-library/registry/default/blocks/social-auth-nextjs/app/auth/oauth/route.ts
index 294e5729176..a89ecfe3543 100644
--- a/apps/ui-library/registry/default/blocks/social-auth-nextjs/app/auth/oauth/route.ts
+++ b/apps/ui-library/registry/default/blocks/social-auth-nextjs/app/auth/oauth/route.ts
@@ -6,7 +6,11 @@ export async function GET(request: Request) {
const { searchParams, origin } = new URL(request.url)
const code = searchParams.get('code')
// if "next" is in param, use it as the redirect URL
- const next = searchParams.get('next') ?? '/'
+ let next = searchParams.get('next') ?? '/'
+ if (!next.startsWith('/')) {
+ // if "next" is not a relative URL, use the default
+ next = '/'
+ }
if (code) {
const supabase = await createClient()
diff --git a/apps/www/app/api-v2/opt-out/[ref]/route.ts b/apps/www/app/api-v2/opt-out/[ref]/route.ts
index 288f3ce9a34..a78adc73f45 100644
--- a/apps/www/app/api-v2/opt-out/[ref]/route.ts
+++ b/apps/www/app/api-v2/opt-out/[ref]/route.ts
@@ -76,7 +76,12 @@ export async function POST(req: NextRequest, { params }: { params: { ref: string
const response = await fetch(process.env.EMAIL_REPORT_SLACK_WEBHOOK as string, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ text: `New report from: ${ref} \n\n ${reason}` }),
+ body: JSON.stringify({
+ blocks: [
+ { type: 'section', text: { type: 'plain_text', text: `New report from: ${ref}` } },
+ { type: 'section', text: { type: 'plain_text', text: reason } },
+ ],
+ }),
})
if (!response.ok) throw new Error('Failed to send to Slack')