reCAPTCHA validation isn’t enforced in Adaptive Forms with fragments
In Adobe Experience Manager Forms, an Adaptive Form that uses a fragment and reCAPTCHA accepts submissions when the reCAPTCHA token is invalid, missing, tampered with, expired, or reused. This behavior occurs when the backend endpoint processes the submission without enforcing server-side reCAPTCHA validation. To fix this, enforce token validation on the backend and verify that the endpoint accepts only submissions containing a valid reCAPTCHA token.
Description description
Environment
- Adobe Experience Manager Forms
- Adaptive Forms using fragments and reCAPTCHA components
Issue/Symptoms
- The backend accepts form submissions containing invalid, missing, or tampered reCAPTCHA tokens.
- Automated tools submit the form without valid CAPTCHA data, and the backend processes the submission successfully.
- The issue occurs when the form uses reCAPTCHA with an Adaptive Form Fragment and the backend doesn’t enforce token validation.
Cause
The backend endpoint that processes the form submission doesn’t enforce server-side validation of the reCAPTCHA token. As a result, it accepts submissions without a valid token.
Resolution resolution
Follow these steps to enforce reCAPTCHA validation for form submissions:
-
Ensure that the backend logic that handles form submissions validates the reCAPTCHA token on the server instead of relying only on client-side validation.
-
Test the backend endpoint by submitting the form with each of the following token states:
- A valid reCAPTCHA token
- An invalid token
- A missing token
- An expired token
- A reused token
Only a valid token should result in a successful submission. The backend should reject all other token states.
-
In CRX/DE, navigate to the reCAPTCHA component used in the affected form. Add a Boolean property named
requiredand set it totrue. Save the changes, and test the form again to verify that submissions with invalid or missing reCAPTCHA data are rejected. -
Check whether any feature toggles related to form validation or reCAPTCHA are enabled or disabled in your environment because they affect the validation logic. Refer to your environment’s configuration documentation for details.
-
Ensure that your AEM Forms version supports the reCAPTCHA version in use. For example, AEM 6.5 supports reCAPTCHA v2 but doesn’t support reCAPTCHA v3.
-
After making these changes, submit the form with valid and invalid reCAPTCHA tokens. Verify that the backend accepts only submissions containing valid tokens.