Skip to content

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

feat: Add hCaptcha settings

Stojan Dimitrovski075e200c3bf0
diff --git a/studio/components/interfaces/Auth/AutoSchemaForm.tsx b/studio/components/interfaces/Auth/AutoSchemaForm.tsx
index 0fbd89f92c4..a6f6b489a5a 100644
--- a/studio/components/interfaces/Auth/AutoSchemaForm.tsx
+++ b/studio/components/interfaces/Auth/AutoSchemaForm.tsx
@@ -22,6 +22,8 @@ const AutoSchemaForm = observer(() => {
JWT_EXP: authConfig.config.JWT_EXP,
SITE_URL: authConfig.config.SITE_URL,
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 || '',
}
const schema = object({
@@ -33,6 +35,8 @@ const AutoSchemaForm = observer(() => {
SECURITY_REFRESH_TOKEN_REUSE_INTERVAL: number()
.min(0, 'Must be a value more than 0')
.required('Must have a Reuse Interval value'),
+ SECURITY_CAPTCHA_ENABLED: boolean().required(),
+ SECURITY_CAPTCHA_SECRET: string(),
})
const isLoaded = authConfig.isLoaded
@@ -46,6 +50,7 @@ const AutoSchemaForm = observer(() => {
onSubmit={async (values: any, { setSubmitting, resetForm }: any) => {
const payload = { ...values }
payload.DISABLE_SIGNUP = !values.DISABLE_SIGNUP
+ payload.SECURITY_CAPTCHA_PROVIDER = 'hcaptcha'
try {
setSubmitting(true)
await authConfig.update(payload)
@@ -142,6 +147,25 @@ const AutoSchemaForm = observer(() => {
/>
</FormSectionContent>
</FormSection>
+ <FormSection header={<FormSectionLabel>Security and Protection</FormSectionLabel>}>
+ <FormSectionContent loading={!isLoaded}>
+ <Toggle
+ id="SECURITY_CAPTCHA_ENABLED"
+ size="small"
+ label="hCaptcha protection"
+ layout="flex"
+ descriptionText="If enabled, protects auth endpoints from abuse."
+ />
+ {values.SECURITY_CAPTCHA_ENABLED && (
+ <Input
+ id="SECURITY_CAPTCHA_SECRET"
+ size="small"
+ label="hCaptcha sitekey"
+ descriptionText="hCaptcha secret (sitekey)"
+ />
+ )}
+ </FormSectionContent>
+ </FormSection>
</FormPanel>
</>
)
diff --git a/studio/stores/jsonSchema/auth_gotrue_config.json b/studio/stores/jsonSchema/auth_gotrue_config.json
index 050e49d264f..22b97d4af6f 100644
--- a/studio/stores/jsonSchema/auth_gotrue_config.json
+++ b/studio/stores/jsonSchema/auth_gotrue_config.json
@@ -382,7 +382,7 @@
"type": "integer",
"help": "Duration before an email otp / link expires."
},
-
+
"MAILER_SUBJECTS_CONFIRMATION": {
"title": "Subject",
"type": "string"
@@ -438,6 +438,16 @@
"title": "Minimum password length",
"type": "integer"
},
+ "SECURITY_CAPTCHA_ENABLED": {
+ "title": "hCaptcha protection",
+ "type": "boolean",
+ "help": "Enables hCaptcha protection on all auth endpoints."
+ },
+ "SECURITY_CAPTCHA_SECRET": {
+ "title": "hCaptcha sitekey",
+ "type": "string",
+ "help": "Secret (sitekey) used to verify hCaptcha challenges."
+ },
"SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION": {
"title": "Enable strict password updates",
"type": "boolean",