#95365Add Submission Timer to EXT:form
Description
Humans are slow
Add a hidden field to your form that contains the current server time (based on when the form was generated).
Then, upon submission, check the form’s timestamp against the current server time.
If the form was submitted too quickly (say, less than 3 seconds) then a human probably didn’t fill it out.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 1
History 4
-
Benni Mack changed Related to #97875 <span data-processor="relativetime" data-value="2025-04-11T11:51:28+00:00" > 04/11/25, 11:51 </span>
-
Benni Mack commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2025-04-11T11:51:44+00:00" > 04/11/25, 11:51 </span> -
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-04-11T13:03:01+00:00" > 04/11/25, 13:03 </span>
(A middleware could do replacement of a cachable placeholder? The timestamp would need some HMAC like encryption of course. We do this with custom form fieldtypes and solved that in userspace, with good success)
-
Georg Ringer commented and changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2026-10-07T19:23:41+00:00" > 10/07/26, 19:23 </span>Thanks for the idea! A submission timer is a nice, lightweight addition to the existing honeypot.
The good news: this can be built as a custom extension today, without any change in the core. EXT:form is flexible enough for that:
- a custom form element (e.g. a hidden field) that holds the timestamp, registered via the form setup YAML
- a custom validator on that element which rejects submissions that are faster than a configurable threshold
- the timestamp signed with
HashService(HMAC), so it can’t be tampered with - if needed, the PSR-14 events of EXT:form (e.g.
AfterFormStateInitializedEvent) to hook into the form runtime
Doing it as an extension also has some real advantages:
- it is not bound to the core release cycle and can be used right away, also in v13 and v14 installations
- the threshold, the behaviour and the handling of edge cases can be tuned freely and iterated on quickly
- it can be tested in real projects first, which gives valuable feedback
One thing to keep in mind is caching, as Benni already pointed out: the first page of a form is rendered in a cached context, so a timestamp generated there would be the time of the cache entry, not of the page view. Garvin’s approach (a cacheable placeholder that is replaced by a signed timestamp in a middleware) solves that nicely and fits well into an extension.
Once such an extension exists and has proven itself in practice, we can still evaluate whether it makes sense to move it into the core, then based on real-world experience instead of assumptions.
Therefore I’m closing this issue for now. If somebody builds such an extension, feel free to share it here!
that means, we could never ever cache the forms?