Skip to content

Conversation

@cweiske
Copy link
Contributor

@cweiske cweiske commented Nov 14, 2025

A new spam prevention method that marks form submissions as spam when a user submits forms too often in a given time frame, e.g. 10x in 5 minutes.
This helps reducing spam flood attacks, because only the first submissions will be allowed.

The RateLimitMethod utilizes the Symfony rate limiter that is already used by the TYPO3 backend login to prevent brute-force attacks.

Implementation notes

Only valid form submissions are counted toward the rate limit. This requires splitting the rate limit check (RateLimitMethod) from the actual rate limit consumption (RateLimitFinisher).

Configuration

Both interval and limit are configurable via TypoScript. All valid DateTimeInterval strings are accepted, allowing interval declarations like "10 minutes" or "5 hours".

Configuring the properties for rate limiting identifier is possible:
Either rate limit all submissions from an IP address, or rate limit submissions from an IP to a certain form only.
Adding form field values is possible as well, preventing duplicate submissions from e.g. an e-mail addresses.

Storage

Rate limit information is stored via TYPO3's caching framework in the 'ratelimiter' cache. This allows admins to share the limit across multiple machines by configuring it to use a database or redis backend.

Heavily inspired by Chris Müller's brotkrueml/typo3-form-rate-limit extension.


When using this spam check method, users will get the standard error:

Spam in Nachricht vermutet: 99% Spam-Wahrscheinlichkeit in dieser Nachricht!

Maybe it would be better to build this as a global validator? This would allow us to display a specific error message.
The downside would be that manual ip-whitelisting would be needed, which already exists for spam shield.

A new spam prevention method that marks form submissions as spam
when a user submits forms too often in a given time frame,
e.g. 10x in 5 minutes.
This helps reducing spam flood attacks, because only the first
submissions will be allowed.

The RateLimitMethod utilizes the Symfony rate limiter
that is already used by the TYPO3 backend login to prevent brute-force
attacks.

Only valid form submissions are counted toward the rate limit.
This requires splitting the rate limit check (RateLimitMethod)
from the actual rate limit consumption (RateLimitFinisher).

Both interval and limit are configurable via TypoScript.
All valid DateTimeInterval strings are accepted, allowing interval
declarations like "10 minutes" or "5 hours".

Configuring the properties for rate limiting identifier is possible:
Either rate limit all submissions from an IP address,
or rate limit submissions from an IP to a certain form only.
Adding form field values is possible as well, preventing
duplicate submissions from e.g. an e-mail addresses.

Rate limit information is stored via TYPO3's caching framework in the
'ratelimiter' cache. This allows admins to share the limit across
multiple machines by configuring it to use a database or redis backend.

Heavily inspired by Chris Müller's brotkrueml/typo3-form-rate-limit
extension.
@cweiske
Copy link
Contributor Author

cweiske commented Nov 17, 2025

I've rebased and split rate limit token consumption from the spam check, so that only valid form submissions are counted towards the rate limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant