Skip to content

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

Add toggle for enabling auto reuse detection

Joshen Lim55df3d14412d
diff --git a/studio/components/interfaces/Auth/AutoSchemaForm.tsx b/studio/components/interfaces/Auth/AutoSchemaForm.tsx
index 90a3456a477..319938ffd76 100644
--- a/studio/components/interfaces/Auth/AutoSchemaForm.tsx
+++ b/studio/components/interfaces/Auth/AutoSchemaForm.tsx
@@ -24,6 +24,7 @@ const AutoSchemaForm = observer(() => {
DISABLE_SIGNUP: !authConfig.config.DISABLE_SIGNUP,
JWT_EXP: authConfig.config.JWT_EXP,
SITE_URL: authConfig.config.SITE_URL,
+ REFRESH_TOKEN_ROTATION_ENABLED: authConfig.config.REFRESH_TOKEN_ROTATION_ENABLED || false,
SECURITY_REFRESH_TOKEN_REUSE_INTERVAL: authConfig.config.SECURITY_REFRESH_TOKEN_REUSE_INTERVAL,
SECURITY_CAPTCHA_ENABLED: authConfig.config.SECURITY_CAPTCHA_ENABLED || false,
SECURITY_CAPTCHA_SECRET: authConfig.config.SECURITY_CAPTCHA_SECRET || '',
@@ -35,6 +36,7 @@ const AutoSchemaForm = observer(() => {
JWT_EXP: number()
.max(604800, 'Must be less than 604800')
.required('Must have a JWT expiry value'),
+ REFRESH_TOKEN_ROTATION_ENABLED: boolean().required(),
SECURITY_REFRESH_TOKEN_REUSE_INTERVAL: number()
.min(0, 'Must be a value more than 0')
.required('Must have a Reuse Interval value'),
@@ -127,14 +129,6 @@ const AutoSchemaForm = observer(() => {
descriptionText="How long tokens are valid for. Defaults to 3600 (1 hour), maximum 604,800 seconds (one week)."
actions={<span className="text-scale-900 mr-3">seconds</span>}
/>
- <InputNumber
- id="SECURITY_REFRESH_TOKEN_REUSE_INTERVAL"
- size="small"
- min={0}
- label="Reuse Interval"
- descriptionText="Time interval where the same refresh token can be used to request for an access token."
- actions={<span className="text-scale-900 mr-3">seconds</span>}
- />
</FormSectionContent>
</FormSection>
<FormSection header={<FormSectionLabel>Security and Protection</FormSectionLabel>}>
@@ -142,9 +136,9 @@ const AutoSchemaForm = observer(() => {
<Toggle
id="SECURITY_CAPTCHA_ENABLED"
size="small"
- label="hCaptcha protection"
+ label="Enable hCaptcha protection"
layout="flex"
- descriptionText="If enabled, protects auth endpoints from abuse."
+ descriptionText="Protect authentication endpoints from abuse."
/>
{values.SECURITY_CAPTCHA_ENABLED && (
<Input
@@ -161,6 +155,23 @@ const AutoSchemaForm = observer(() => {
}
/>
)}
+ <Toggle
+ id="REFRESH_TOKEN_ROTATION_ENABLED"
+ size="small"
+ label="Enable automatic reuse detection"
+ layout="flex"
+ descriptionText="Prevent replay attacks from compromised refresh tokens."
+ />
+ {values.REFRESH_TOKEN_ROTATION_ENABLED && (
+ <InputNumber
+ id="SECURITY_REFRESH_TOKEN_REUSE_INTERVAL"
+ size="small"
+ min={0}
+ label="Reuse Interval"
+ descriptionText="Time interval where the same refresh token can be used to request for an access token."
+ actions={<span className="text-scale-900 mr-3">seconds</span>}
+ />
+ )}
</FormSectionContent>
</FormSection>
</FormPanel>