Skip to content

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

feat: Add 2KB limit validation on redirect URLs (#8477)

Stojan Dimitrovski4262c194f797
diff --git a/studio/components/interfaces/Auth/RedirectDomains/RedirectDomains.tsx b/studio/components/interfaces/Auth/RedirectDomains/RedirectDomains.tsx
index 8c066765281..b6b6cf97cc0 100644
--- a/studio/components/interfaces/Auth/RedirectDomains/RedirectDomains.tsx
+++ b/studio/components/interfaces/Auth/RedirectDomains/RedirectDomains.tsx
@@ -28,7 +28,19 @@ const RedirectDomains = () => {
const payload = URI_ALLOW_LIST_ARRAY
payload.push(values.domain)
- const { error } = await authConfig.update({ URI_ALLOW_LIST: payload.toString() })
+ const payloadString = payload.toString()
+
+ if (payloadString.length > 2 * 1024) {
+ ui.setNotification({
+ message: 'Too many redirect domains, please remove some or try to use wildcards',
+ category: 'error',
+ })
+
+ setSubmitting(false)
+ return
+ }
+
+ const { error } = await authConfig.update({ URI_ALLOW_LIST: payloadString })
if (!error) {
setOpen(false)
ui.setNotification({ category: 'success', message: 'Successfully added domain' })