Skip to content

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

Reinstate rate limit fields for token refresh and verify (#18328)

Joshen Lime670d4d04f18
diff --git a/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx b/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx
index b6d588e2e8e..2de1f7755e7 100644
--- a/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx
+++ b/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx
@@ -60,13 +60,22 @@ const RateLimits = () => {
const canUpdateSMSRateLimit = authConfig?.EXTERNAL_PHONE_ENABLED && !authConfig?.SMS_AUTOCONFIRM
const FormSchema = z.object({
- RATE_LIMIT_TOKEN_REFRESH: z.coerce.number().min(0, 'Must be not be lower than 0'),
- RATE_LIMIT_VERIFY: z.coerce.number().min(0, 'Must be not be lower than 0'),
+ RATE_LIMIT_TOKEN_REFRESH: z.coerce
+ .number()
+ .min(0, 'Must be not be lower than 0')
+ .max(32767, 'Must not be more than 32,767 an 5 minutes'),
+ RATE_LIMIT_VERIFY: z.coerce
+ .number()
+ .min(0, 'Must be not be lower than 0')
+ .max(32767, 'Must not be more than 32,767 an 5 minutes'),
RATE_LIMIT_EMAIL_SENT: z.coerce
.number()
.min(0, 'Must be not be lower than 0')
.max(32767, 'Must not be more than 32,767 an hour'),
- RATE_LIMIT_SMS_SENT: z.coerce.number().min(0, 'Must be not be lower than 0'),
+ RATE_LIMIT_SMS_SENT: z.coerce
+ .number()
+ .min(0, 'Must be not be lower than 0')
+ .max(32767, 'Must not be more than 32,767 an hour'),
})
const form = useForm<z.infer<typeof FormSchema>>({
@@ -82,22 +91,25 @@ const RateLimits = () => {
const onSubmit = (data: z.infer<typeof FormSchema>) => {
if (!projectRef) return console.error('Project ref is required')
- // [Joshen] Temporarily removing RATE_LIMIT_TOKEN_REFRESH and RATE_LIMIT_VERIFY until BE supports it
const payload: Partial<z.infer<typeof FormSchema>> = {}
- if (data.RATE_LIMIT_EMAIL_SENT !== authConfig?.RATE_LIMIT_EMAIL_SENT) {
- payload.RATE_LIMIT_EMAIL_SENT = data.RATE_LIMIT_EMAIL_SENT
- }
- if (data.RATE_LIMIT_SMS_SENT !== authConfig?.RATE_LIMIT_SMS_SENT) {
- payload.RATE_LIMIT_SMS_SENT = data.RATE_LIMIT_SMS_SENT
- }
+ const params = [
+ 'RATE_LIMIT_TOKEN_REFRESH',
+ 'RATE_LIMIT_VERIFY',
+ 'RATE_LIMIT_EMAIL_SENT',
+ 'RATE_LIMIT_SMS_SENT',
+ ] as (keyof typeof payload)[]
+ params.forEach((param) => {
+ if (data[param] !== authConfig?.[param]) payload[param] = data[param]
+ })
+
updateAuthConfig({ projectRef, config: payload }, { onSuccess: () => form.reset(data) })
}
useEffect(() => {
if (isSuccess) {
form.reset({
- RATE_LIMIT_TOKEN_REFRESH: 30,
- RATE_LIMIT_VERIFY: 30,
+ RATE_LIMIT_TOKEN_REFRESH: authConfig.RATE_LIMIT_TOKEN_REFRESH,
+ RATE_LIMIT_VERIFY: authConfig.RATE_LIMIT_VERIFY,
RATE_LIMIT_EMAIL_SENT: authConfig.RATE_LIMIT_EMAIL_SENT,
RATE_LIMIT_SMS_SENT: authConfig.RATE_LIMIT_SMS_SENT,
})
@@ -256,8 +268,7 @@ const RateLimits = () => {
</FormSectionContent>
</FormSection>
- {/* [Joshen] The bottom 2 fields are hidden for now until BE support is ready */}
- {/* <FormSection
+ <FormSection
id="token-refresh"
header={
<FormSectionLabel
@@ -278,7 +289,7 @@ const RateLimits = () => {
render={({ field }) => (
<FormItem_Shadcn_>
<FormControl_Shadcn_>
- <Input_Shadcn_ disabled type="number" {...field} />
+ <Input_Shadcn_ type="number" {...field} />
</FormControl_Shadcn_>
{field.value > 0 && (
<>
@@ -292,9 +303,9 @@ const RateLimits = () => {
)}
/>
</FormSectionContent>
- </FormSection> */}
+ </FormSection>
- {/* <FormSection
+ <FormSection
id="verify"
header={
<FormSectionLabel
@@ -316,7 +327,7 @@ const RateLimits = () => {
render={({ field }) => (
<FormItem_Shadcn_>
<FormControl_Shadcn_>
- <Input_Shadcn_ disabled type="number" {...field} />
+ <Input_Shadcn_ type="number" {...field} />
</FormControl_Shadcn_>
{field.value > 0 && (
<p className="text-foreground-lighter text-sm">
@@ -328,7 +339,7 @@ const RateLimits = () => {
)}
/>
</FormSectionContent>
- </FormSection> */}
+ </FormSection>
</FormPanel>
</form>
</Form_Shadcn_>
diff --git a/studio/components/ui/Forms/FormHeader.tsx b/studio/components/ui/Forms/FormHeader.tsx
index b6a709aba4e..88261b2619c 100644
--- a/studio/components/ui/Forms/FormHeader.tsx
+++ b/studio/components/ui/Forms/FormHeader.tsx
@@ -26,9 +26,11 @@ const FormHeader = ({
)}
</div>
{docsUrl !== undefined && (
- <Link passHref href="/">
+ <Link passHref href={docsUrl}>
<Button asChild type="default" icon={<IconExternalLink />}>
- <a>Documentation</a>
+ <a target="_blank" rel="noreferrer">
+ Documentation
+ </a>
</Button>
</Link>
)}
diff --git a/studio/data/api.d.ts b/studio/data/api.d.ts
index bae3675bd96..8bc2c6871eb 100644
--- a/studio/data/api.d.ts
+++ b/studio/data/api.d.ts
@@ -168,6 +168,14 @@ export interface paths {
/** Gets usage stats */
get: operations['OrgUsageController_getDailyStats']
}
+ '/platform/organizations/{slug}/documents/standard-security-questionnaire': {
+ /** Get standard security questionnaire URL */
+ get: operations['OrgDocumentsController_getStandardSecurityQuestionnaireUrl']
+ }
+ '/platform/organizations/{slug}/documents/soc2-type-2-report': {
+ /** Get SOC2 Type 2 report URL */
+ get: operations['OrgDocumentsController_getSoc2Type2ReportUrl']
+ }
'/platform/organizations/{slug}/audit': {
/** Gets an organization's audit logs */
get: operations['OrgAuditLogsController_getAuditLogs']
@@ -1726,6 +1734,8 @@ export interface components {
cpu_exhaustion: 'critical' | 'warning' | null
/** @enum {string|null} */
memory_and_swap_exhaustion: 'critical' | 'warning' | null
+ /** @enum {string|null} */
+ auth_rate_limit_exhaustion: 'critical' | 'warning' | null
project: string
is_readonly_mode_enabled: boolean
}
@@ -1762,6 +1772,8 @@ export interface components {
SECURITY_CAPTCHA_SECRET: string
RATE_LIMIT_EMAIL_SENT: number
RATE_LIMIT_SMS_SENT: number
+ RATE_LIMIT_VERIFY?: number
+ RATE_LIMIT_TOKEN_REFRESH?: number
MAILER_SECURE_EMAIL_CHANGE_ENABLED: boolean
REFRESH_TOKEN_ROTATION_ENABLED: boolean
PASSWORD_MIN_LENGTH: number
@@ -1820,6 +1832,7 @@ export interface components {
EXTERNAL_GOOGLE_CLIENT_ID: string
EXTERNAL_GOOGLE_SECRET: string
EXTERNAL_GOOGLE_ADDITIONAL_CLIENT_IDS?: string
+ EXTERNAL_GOOGLE_SKIP_NONCE_CHECK?: boolean
EXTERNAL_KAKAO_ENABLED: boolean
EXTERNAL_KAKAO_CLIENT_ID: string
EXTERNAL_KAKAO_SECRET: string
@@ -1830,6 +1843,9 @@ export interface components {
EXTERNAL_LINKEDIN_ENABLED: boolean
EXTERNAL_LINKEDIN_CLIENT_ID: string
EXTERNAL_LINKEDIN_SECRET: string
+ EXTERNAL_LINKEDIN_OIDC_ENABLED: boolean
+ EXTERNAL_LINKEDIN_OIDC_CLIENT_ID: string
+ EXTERNAL_LINKEDIN_OIDC_SECRET: string
EXTERNAL_NOTION_ENABLED: boolean
EXTERNAL_NOTION_CLIENT_ID: string
EXTERNAL_NOTION_SECRET: string
@@ -1886,6 +1902,8 @@ export interface components {
SECURITY_CAPTCHA_SECRET?: string
RATE_LIMIT_EMAIL_SENT?: number
RATE_LIMIT_SMS_SENT?: number
+ RATE_LIMIT_VERIFY?: number
+ RATE_LIMIT_TOKEN_REFRESH?: number
MAILER_SECURE_EMAIL_CHANGE_ENABLED?: boolean
REFRESH_TOKEN_ROTATION_ENABLED?: boolean
PASSWORD_MIN_LENGTH?: number
@@ -1945,6 +1963,7 @@ export interface components {
EXTERNAL_GOOGLE_CLIENT_ID?: string
EXTERNAL_GOOGLE_SECRET?: string
EXTERNAL_GOOGLE_ADDITIONAL_CLIENT_IDS?: string
+ EXTERNAL_GOOGLE_SKIP_NONCE_CHECK?: boolean
EXTERNAL_KAKAO_ENABLED?: boolean
EXTERNAL_KAKAO_CLIENT_ID?: string
EXTERNAL_KAKAO_SECRET?: string
@@ -1955,6 +1974,9 @@ export interface components {
EXTERNAL_LINKEDIN_ENABLED?: boolean
EXTERNAL_LINKEDIN_CLIENT_ID?: string
EXTERNAL_LINKEDIN_SECRET?: string
+ EXTERNAL_LINKEDIN_OIDC_ENABLED?: boolean
+ EXTERNAL_LINKEDIN_OIDC_CLIENT_ID?: string
+ EXTERNAL_LINKEDIN_OIDC_SECRET?: string
EXTERNAL_NOTION_ENABLED?: boolean
EXTERNAL_NOTION_CLIENT_ID?: string
EXTERNAL_NOTION_SECRET?: string
@@ -2011,6 +2033,8 @@ export interface components {
SECURITY_CAPTCHA_SECRET: string
RATE_LIMIT_EMAIL_SENT: number
RATE_LIMIT_SMS_SENT: number
+ RATE_LIMIT_VERIFY?: number
+ RATE_LIMIT_TOKEN_REFRESH?: number
MAILER_SECURE_EMAIL_CHANGE_ENABLED: boolean
REFRESH_TOKEN_ROTATION_ENABLED: boolean
PASSWORD_MIN_LENGTH: number
@@ -2069,6 +2093,7 @@ export interface components {
EXTERNAL_GOOGLE_CLIENT_ID: string
EXTERNAL_GOOGLE_SECRET: string
EXTERNAL_GOOGLE_ADDITIONAL_CLIENT_IDS?: string
+ EXTERNAL_GOOGLE_SKIP_NONCE_CHECK?: boolean
EXTERNAL_KAKAO_ENABLED: boolean
EXTERNAL_KAKAO_CLIENT_ID: string
EXTERNAL_KAKAO_SECRET: string
@@ -2079,6 +2104,9 @@ export interface components {
EXTERNAL_LINKEDIN_ENABLED: boolean
EXTERNAL_LINKEDIN_CLIENT_ID: string
EXTERNAL_LINKEDIN_SECRET: string
+ EXTERNAL_LINKEDIN_OIDC_ENABLED: boolean
+ EXTERNAL_LINKEDIN_OIDC_CLIENT_ID: string
+ EXTERNAL_LINKEDIN_OIDC_SECRET: string
EXTERNAL_NOTION_ENABLED: boolean
EXTERNAL_NOTION_CLIENT_ID: string
EXTERNAL_NOTION_SECRET: string
@@ -2384,6 +2412,9 @@ export interface components {
slugs: string[]
usages: components['schemas']['OrgMetricUsage'][]
}
+ OrgDocumentUrlResponse: {
+ fileUrl: string
+ }
AuditLogsResponse: {
result: Record<string, never>[]
retention_period: number
@@ -3882,9 +3913,7 @@ export interface components {
Invoice: {
id: string
invoice_pdf: string
- custom_fields: Record<string, never>[]
subscription: string
- hosted_invoice_url: string
subtotal: number
number: string
period_end: number
@@ -3894,91 +3923,6 @@ export interface components {
organization_id: number
overdue_invoice_count: number
}
- StripeInvoice: {
- id: string
- object: Record<string, never>
- account_country: string
- account_name: string
- account_tax_ids: Record<string, never>
- amount_due: number
- amount_paid: number
- amount_remaining: number
- application: string
- application_fee_amount: number
- attempt_count: number
- attempted: boolean
- auto_advance?: boolean
- automatic_tax: Record<string, never>
- billing_reason: Record<string, never>
- charge: Record<string, never>
- collection_method: Record<string, never>
- created: number
- currency: string
- custom_fields: Record<string, never>
- customer: Record<string, never>
- customer_address: Record<string, never>
- customer_email: string
- customer_name: string
- customer_phone: string
- customer_shipping: Record<string, never>
- customer_tax_exempt: Record<string, never>
- customer_tax_ids?: Record<string, never>
- default_payment_method: Record<string, never>
- default_source: Record<string, never>
- default_tax_rates: Record<string, never>
- deleted?: Record<string, never>
- description: string
- discount: Record<string, never>
- discounts: Record<string, never>
- due_date: number
- ending_balance: number
- footer: string
- hosted_invoice_url?: string
- invoice_pdf?: string
- last_finalization_error: Record<string, never>
- lines: Record<string, never>
- livemode: boolean
- metadata: Record<string, never>
- next_payment_attempt: number
- number: string
- on_behalf_of: Record<string, never>
- paid: boolean
- paid_out_of_band: boolean
- payment_intent: Record<string, never>
- payment_settings: Record<string, never>
- period_end: number
- period_start: number
- post_payment_credit_notes_amount: number
- pre_payment_credit_notes_amount: number
- quote: Record<string, never>
- receipt_number: string
- rendering_options: Record<string, never>
- starting_balance: number
- statement_descriptor: string
- status: Record<string, never>
- status_transitions: Record<string, never>
- subscription: Record<string, never>
- subscription_proration_date?: number
- subtotal: number
- subtotal_excluding_tax: number
- tax: number
- test_clock: Record<string, never>
- threshold_reason?: Record<string, never>
- total: number
- total_discount_amounts: Record<string, never>
- total_excluding_tax: number
- total_tax_amounts: Record<string, never>
- transfer_data: Record<string, never>
- webhooks_delivered_at: number
- lastResponse: {
- headers?: Record<string, never>
- requestId?: string
- statusCode?: number
- apiVersion?: string
- idempotencyKey?: string
- stripeAccount?: string
- }
- }
GoogleAnalyticBody: {
language?: string
screen_resolution?: string
@@ -4676,6 +4620,10 @@ export interface components {
content: components['schemas']['SnippetContent']
}
ResourceStatusResponse: {
+ /** @description Supabase project instance compute size */
+ compute: string
+ /** @description Unique ID representing the fly extension */
+ id: string
/**
* @description Supabase project status
* @example ACTIVE_HEALTHY
@@ -5623,6 +5571,38 @@ export interface operations {
500: never
}
}
+ /** Get standard security questionnaire URL */
+ OrgDocumentsController_getStandardSecurityQuestionnaireUrl: {
+ parameters: {
+ path: {
+ /** @description Organization slug */
+ slug: string
+ }
+ }
+ responses: {
+ 200: {
+ content: {
+ 'application/json': components['schemas']['OrgDocumentUrlResponse']
+ }
+ }
+ }
+ }
+ /** Get SOC2 Type 2 report URL */
+ OrgDocumentsController_getSoc2Type2ReportUrl: {
+ parameters: {
+ path: {
+ /** @description Organization slug */
+ slug: string
+ }
+ }
+ responses: {
+ 200: {
+ content: {
+ 'application/json': components['schemas']['OrgDocumentUrlResponse']
+ }
+ }
+ }
+ }
/** Gets an organization's audit logs */
OrgAuditLogsController_getAuditLogs: {
parameters: {
@@ -8845,7 +8825,7 @@ export interface operations {
responses: {
200: {
content: {
- 'application/json': components['schemas']['StripeInvoice']
+ 'application/json': components['schemas']['Invoice']
}
}
/** @description Failed to retrieve invoice */
@@ -9264,6 +9244,10 @@ export interface operations {
/** Gets github branches for a given repo */
GitHubBranchController_getBranches: {
parameters: {
+ query?: {
+ per_page?: number
+ page?: number
+ }
path: {
organization_integration_id: string
repo_owner: string