#111742Introduce a spam protection provider API
Description
Problem
The form framework has one built-in protection against automated submissions: the honeypot. It is hard-wired into FormRuntime (initializeHoneypotFromRequest(), renderHoneypot()) and configured through renderingOptions.honeypot. There is no extension point for any other mechanism.
Every captcha or bot-detection integration therefore re-implements the same pieces on its own: a custom form element, a validator attached to it, Fluid partials, form editor configuration and, often, JavaScript.
Proposal
Introduce a provider API for spam protection in EXT:form. The core ships the API, not the captcha services. This follows the decision in #63773 that captcha integrations belong in extensions: the API makes those extensions smaller and interchangeable.
- A
SpamProtectionProviderInterface(name open for discussion) with a method that contributes rendering (markup, assets) and a method that verifies the submitted request. It returns a result with an optional error message. - Registration through a service tag or attribute (autoconfigured), like the other tagged extension points in the core.
- Selection per form definition (for example
renderingOptions.spamProtection.provider), with a default per site / site set, so that forms are protected without an element on each of them. - Verification runs in
FormRuntimebefore the finishers on the last page. Failure leads back to the form with an error, like a validation failure. - The existing honeypot becomes the first provider implementation. Existing
renderingOptions.honeypotconfiguration keeps working (migration or BC layer). - Optionally, a second built-in provider that does not depend on a third party, for example a minimum fill-in time check (signed timestamp in the form state). This proves the API with more than one implementation.
- A PSR-14 event or a log entry when a submission is rejected, so that integrators can monitor false positives.
Out of scope
- Shipping integrations for third-party services (reCAPTCHA, hCaptcha, Friendly Captcha, …). They stay in extensions.
- Rate limiting of submissions (see https://review.typo3.org/c/Packages/TYPO3.CMS/+/98344).
- CSRF protection for forms of logged-in users (#84566, #93452). That is a different threat and has its own issues.
Related
- #63773 Integrate captcha (rejected 2015: captcha integrations belong in extensions)
- Captcha support was removed from the old form extension in 2011 (#28651, https://review.typo3.org/c/Packages/TYPO3.CMS/+/3985). No extension point replaced it.
Reviews 1
History 01
-
Gerrit Code Review pushed patch set 1 for main to change 98369 status
NewUnder Review 12/05/26, 16:37