Drupal Canvas Forms verifies that submissions originate from a human through a CAPTCHA challenge on the forms. CAPTCHA provides a provider-agnostic, site-wide layer. An administrator configures one provider and one enforcement mode, and the setting applies to every Drupal Canvas form. The server verifies the CAPTCHA response of each submission before it accepts the data. CAPTCHA runs in addition to the built-in spam controls, and it runs after them because the CAPTCHA verification requires a network call to the provider.
Drupal Canvas Forms enforces the following protections for unauthenticated endpoints:
Protection | Description |
|---|---|
Honeypot traps | A hidden honeypot field must remain empty. If the system detects a filled honeypot, it stores the submission as a suspect record and returns a response that appears successful to prevent bots from detection. The system does not send webhooks for suspect submissions. |
Signed challenge tokens | The system requires a single-use, signed challenge token before each submission and file upload. This token proves that the request originated from a real browser and prevents replay attacks. |
Rate limiting | Drupal Canvas Forms enforces per-Internet Protocol (IP) address limits and site-wide limits within a time window. By default, this limit is 10 submissions per IP address every 10 minutes, with a higher global ceiling. Rejected spam counts toward these limits. File uploads and token requests maintain separate limits. |
CAPTCHA supports the following providers:
Provider | Notes |
|---|---|
Cloudflare Turnstile | Privacy-friendly challenge with no visible puzzle in most cases. |
hCAPTCHA | Widget-based challenge. |
Friendly CAPTCHA | Proof-of-work challenge with no user interaction. |
Google reCAPTCHA v3 | Invisible, score-based verification. |
CAPTCHA features two modes to verify form setups before the system blocks submissions:
CAPTCHA never locks out real users because of a configuration problem or a provider problem. If an administrator disables CAPTCHA, misconfigures CAPTCHA, or the provider becomes unreachable, Drupal Canvas Forms does not block submissions based on the CAPTCHA signal. The honeypot, rate limit, and challenge token controls continue to apply. Only a definitive verification failure, or an absent token in the Enforce mode, rejects a submission.
To configure CAPTCHA:
In the Source CMS administration menu, click Configuration.
Click System and select CAPTCHA.
Choose Monitor for the Mode to start.
Drupal Canvas Forms stores the secret key securely on the server and never displays it again. To replace the secret key, enter a new value and save the configuration. To remove the secret key, select Remove the stored secret. An administrator cannot remove the secret key while CAPTCHA remains enabled. Enter a replacement key first or disable CAPTCHA.
While CAPTCHA remains enabled, the starter code generated on the Connect view includes the CAPTCHA widget. Forms generated or regenerated work with CAPTCHA automatically.
To add the widget to a hand-authored form component, add two lines of code:
Add the import at the top of the component with the other imports:
import { CanvasFormCaptcha } from 'acquia/captcha';Add the widget inside the form before the submit button:
<CanvasFormCaptcha />The widget locates its own enclosing form and requires no properties. The CAPTCHA settings page displays these two snippets for easy duplication.
Turn CAPTCHA on in the Monitor mode first. In this mode, Canvas Forms logs a message for any submission that the system would otherwise reject, which includes submissions to forms that lack the widget. This helps administrators find and fix errors without turning away real visitors. After the logs confirm that all forms submit valid CAPTCHA tokens, change the Mode to Enforce and Save.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.