SDP-2009: Add endpoint for fetch captcha config#1052
Conversation
|
stellar-disbursement-platform-backend-preview is available here: |
There was a problem hiding this comment.
Pull request overview
Adds a public endpoint to expose CAPTCHA configuration to the frontend and updates password-reset flow to respect organization-level CAPTCHA disablement (not just env-level flags), as part of reCAPTCHA v3 support.
Changes:
- Add
GET /organization/captcha-configto return CAPTCHA type and whether CAPTCHA is disabled for a given organization. - Update forgot-password handler (and tests) to use
IsCAPTCHADisabled()for org-level override behavior. - Adjust dev/testnet configuration and document the change in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/serve/validators/recaptcha_v3.go | Adds debug prints during v3 verification flow. |
| internal/serve/serve.go | Registers new /organization/captcha-config route. |
| internal/serve/httphandler/forgot_password_handler.go | Uses org-aware CAPTCHA disablement checks in validation + execution. |
| internal/serve/httphandler/forgot_password_handler_test.go | Updates unit test to pass context and set org-level CAPTCHA flag in DB. |
| internal/serve/httphandler/captcha_config_handler.go | Implements the new public handler resolving tenant + org-level CAPTCHA flag. |
| internal/serve/httphandler/captcha_config_handler_test.go | Adds handler test coverage for missing org name, unknown org, and override behavior. |
| dev/env-config-testnet.js | Updates testnet RECAPTCHA site key used by the dev frontend config. |
| dev/docker-compose-sdp.yml | Exposes CAPTCHA_TYPE env var in local docker-compose. |
| CHANGELOG.md | Adds entry for the new endpoint. |
3132636 to
a77093b
Compare
|
stellar-disbursement-platform-backend-preview is available here: |
|
stellar-disbursement-platform-backend-preview is available here: |
|
stellar-disbursement-platform-backend-preview is available here: |
|
stellar-disbursement-platform-backend-preview is available here: |
| SEP10_CLIENT_ATTRIBUTION_REQUIRED: ${SEP10_CLIENT_ATTRIBUTION_REQUIRED:-true} | ||
| DISTRIBUTION_PUBLIC_KEY: ${DISTRIBUTION_PUBLIC_KEY} | ||
| DISTRIBUTION_SEED: ${DISTRIBUTION_SEED} | ||
| CAPTCHA_TYPE: ${CAPTCHA_TYPE:-GOOGLE_RECAPTCHA_V2} |
There was a problem hiding this comment.
V3 is a lot less annoying. That could be the default?
There was a problem hiding this comment.
Also wondering if we need to touch the other Docker Compose files or the .env.example.
There was a problem hiding this comment.
-
I was thinking of handling it in a separate PR. If we’re making v3 the default, we should update all at once (CAPTCHA_TYPE defaults, the wizard script, README etc). Also note there's no public test keys for v3 , we also need to throw error if user try to enable reCAPTCHA when no site key is provided
-
All the other docker files don't reference any CAPTCHA vars at all so no need to change.
What
/app-configendpoint to fetch captcha config for FE useforgot_password_handler.goto checkIsCAPTCHADisabled()instead of env varh.ReCAPTCHADisabled, which is only the env-level flag.Why
reCAPTCHA v3
Known limitations
To test reCAPTCHA v3 locally, you will need to update
.envwithand
env-config-testnet.js(the nginx)withChecklist
SDP-1234: Add new featureorChore: Refactor package xyzformat. The Jira ticket code was included if available.CHANGELOG.mdis updated (if applicable)Contract WASM Artifactsworkflow and open a PR to update the WASMs ondev